Remove atom_process_singleton, just use the Chrome classes directly
This commit is contained in:
parent
d020a7dc86
commit
de66888051
5 changed files with 12 additions and 87 deletions
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
|
@ -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_
|
|
@ -130,7 +130,6 @@
|
|||
'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',
|
||||
|
|
Loading…
Reference in a new issue