]> khamidou — GitHub mirrors - electron.git/commitdiff
Remove atom_process_singleton, just use the Chrome classes directly
authorPaul Betts <paul@paulbetts.org>
Wed, 21 Oct 2015 20:38:32 +0000 (13:38 -0700)
committerPaul Betts <paul@paulbetts.org>
Wed, 21 Oct 2015 20:38:39 +0000 (13:38 -0700)
atom/browser/api/atom_api_app.cc
atom/browser/api/atom_api_app.h
atom/browser/atom_process_singleton.cc [deleted file]
atom/browser/atom_process_singleton.h [deleted file]
filenames.gypi

index 6906608fb76f7cf742bb738080a887e65daca153..c46f0748e3b6d71af2a601b41b844b59cb13292f 100644 (file)
@@ -197,7 +197,7 @@ void App::OnFinishLaunching() {
   default_session_.Reset(isolate(), handle.ToV8());
 
   if (process_singleton_.get()) {
-    process_singleton_->Unlock();
+    process_singleton_startup_lock_->Unlock();
   }
 
   Emit("ready");
@@ -287,10 +287,16 @@ bool App::MakeSingleInstance(ProcessSingleton::NotificationCallback callback) {
 
   if (!process_singleton_.get()) {
     auto browser = Browser::Get();
-    process_singleton_.reset(new AtomProcessSingleton(userDir, callback));
+    process_singleton_startup_lock_.reset(
+      new ProcessSingletonStartupLock(callback));
+
+    process_singleton_.reset(
+      new ProcessSingleton(
+        userDir,
+        process_singleton_startup_lock_->AsNotificationCallback()));
 
     if (browser->is_ready()) {
-      process_singleton_->Unlock();
+      process_singleton_startup_lock_->Unlock();
     }
 
     process_notify_result_ = process_singleton_->NotifyOtherProcessOrCreate();
index 77944d3441eafd0577a5b5edc833bf1879558f83..314eeea8811d6b113fbe5335d852c8124c0a0c6f 100644 (file)
@@ -8,10 +8,10 @@
 #include <string>
 
 #include "atom/browser/api/event_emitter.h"
-#include "atom/browser/atom_process_singleton.h"
 #include "atom/browser/browser_observer.h"
 #include "atom/common/native_mate_converters/callback.h"
 #include "chrome/browser/process_singleton.h"
+#include "chrome/browser/process_singleton_startup_lock.h"
 #include "content/public/browser/gpu_data_manager_observer.h"
 #include "native_mate/handle.h"
 
@@ -78,7 +78,8 @@ class App : public mate::EventEmitter,
 
   v8::Global<v8::Value> default_session_;
 
-  scoped_ptr<AtomProcessSingleton> process_singleton_;
+  scoped_ptr<ProcessSingleton> process_singleton_;
+  scoped_ptr<ProcessSingletonStartupLock> process_singleton_startup_lock_;
   ProcessSingleton::NotifyResult process_notify_result_;
 
   DISALLOW_COPY_AND_ASSIGN(App);
diff --git a/atom/browser/atom_process_singleton.cc b/atom/browser/atom_process_singleton.cc
deleted file mode 100644 (file)
index e9e4dc7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "atom/browser/atom_process_singleton.h"
-
-AtomProcessSingleton::AtomProcessSingleton(
-    const base::FilePath& user_data_dir,
-    const ProcessSingleton::NotificationCallback& notification_callback)
-    : startup_lock_(notification_callback),
-      process_singleton_(user_data_dir,
-                         startup_lock_.AsNotificationCallback()) {
-}
-
-AtomProcessSingleton::~AtomProcessSingleton() {
-}
-
-ProcessSingleton::NotifyResult
-    AtomProcessSingleton::NotifyOtherProcessOrCreate() {
-  return process_singleton_.NotifyOtherProcessOrCreate();
-}
-
-void AtomProcessSingleton::Cleanup() {
-  process_singleton_.Cleanup();
-}
-
-void AtomProcessSingleton::Unlock() {
-  startup_lock_.Unlock();
-}
diff --git a/atom/browser/atom_process_singleton.h b/atom/browser/atom_process_singleton.h
deleted file mode 100644 (file)
index 89feeae..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ATOM_BROWSER_ATOM_PROCESS_SINGLETON_H_
-#define ATOM_BROWSER_ATOM_PROCESS_SINGLETON_H_
-
-#include "base/basictypes.h"
-#include "base/files/file_path.h"
-#include "chrome/browser/process_singleton.h"
-#include "chrome/browser/process_singleton_startup_lock.h"
-
-// Composes a basic ProcessSingleton with ProcessSingletonStartupLock
-class AtomProcessSingleton {
- public:
-  AtomProcessSingleton(
-      const base::FilePath& user_data_dir,
-      const ProcessSingleton::NotificationCallback& notification_callback);
-
-  ~AtomProcessSingleton();
-
-  // Notify another process, if available. Otherwise sets ourselves as the
-  // singleton instance. Returns PROCESS_NONE if we became the singleton
-  // instance. Callers are guaranteed to either have notified an existing
-  // process or have grabbed the singleton (unless the profile is locked by an
-  // unreachable process).
-  ProcessSingleton::NotifyResult NotifyOtherProcessOrCreate();
-
-  // Clear any lock state during shutdown.
-  void Cleanup();
-
-  // Executes previously queued command-line invocations and allows future
-  // invocations to be executed immediately.
-  // This only has an effect the first time it is called.
-  void Unlock();
-
- private:
-  // We compose these two locks with the client-supplied notification callback.
-  // First |modal_dialog_lock_| will discard any notifications that arrive while
-  // a modal dialog is active. Otherwise, it will pass the notification to
-  // |startup_lock_|, which will queue notifications until |Unlock()| is called.
-  // Notifications passing through both locks are finally delivered to our
-  // client.
-  ProcessSingletonStartupLock startup_lock_;
-
-  // The basic ProcessSingleton
-  ProcessSingleton process_singleton_;
-
-  DISALLOW_COPY_AND_ASSIGN(AtomProcessSingleton);
-};
-
-#endif  // ATOM_BROWSER_ATOM_PROCESS_SINGLETON_H_
index 3f3d1019c243d1266465f604591e82ae2e74978e..ec7ab3291b3fc594bf297277ee4c6671b8788640 100644 (file)
       'atom/browser/atom_browser_main_parts_posix.cc',
       'atom/browser/atom_javascript_dialog_manager.cc',
       'atom/browser/atom_javascript_dialog_manager.h',
-      'atom/browser/atom_process_singleton.cc',
       'atom/browser/atom_quota_permission_context.cc',
       'atom/browser/atom_quota_permission_context.h',
       'atom/browser/atom_resource_dispatcher_host_delegate.cc',