diff options
author | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-05 19:48:58 +0000 |
---|---|---|
committer | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-05 19:48:58 +0000 |
commit | de2658d5131e55239517f66c9ee19e3153941599 (patch) | |
tree | 7a262c083c035746b2916c662762e3b2d16fb4f8 /chrome/browser/service | |
parent | ed27fa208601080479f3ef4e85d48c80ec778f97 (diff) | |
download | chromium_src-de2658d5131e55239517f66c9ee19e3153941599.zip chromium_src-de2658d5131e55239517f66c9ee19e3153941599.tar.gz chromium_src-de2658d5131e55239517f66c9ee19e3153941599.tar.bz2 |
Removed the ServiceProcessType enum because a single service process should host all types of services. Also implemeneted a rudimentary singleton mechanism for the service process on Windows.
BUG=None
TEST=Test cloud print proxy and remoting UI.
Review URL: http://codereview.chromium.org/3521012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/service')
5 files changed, 10 insertions, 22 deletions
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index c3c16d8..6af47c3 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -50,7 +50,7 @@ class ServiceProcessControl::Launcher } void DoDetectLaunched(Task* task) { - if (CheckServiceProcessRunning(kServiceProcessCloudPrint)) { + if (CheckServiceProcessRunning()) { ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, NewRunnableMethod(this, &Launcher::Notify, task)); return; @@ -75,10 +75,8 @@ class ServiceProcessControl::Launcher }; // ServiceProcessControl implementation. -ServiceProcessControl::ServiceProcessControl(Profile* profile, - ServiceProcessType type) +ServiceProcessControl::ServiceProcessControl(Profile* profile) : profile_(profile), - type_(type), message_handler_(NULL) { } @@ -116,7 +114,7 @@ void ServiceProcessControl::Launch(Task* task) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); // If the service process is already running then connects to it. - if (CheckServiceProcessRunning(kServiceProcessCloudPrint)) { + if (CheckServiceProcessRunning()) { ConnectInternal(task); return; } diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h index 46c2a18..021b669 100644 --- a/chrome/browser/service/service_process_control.h +++ b/chrome/browser/service/service_process_control.h @@ -13,7 +13,6 @@ #include "base/process.h" #include "base/scoped_ptr.h" #include "base/task.h" -#include "chrome/common/service_process_type.h" #include "ipc/ipc_sync_channel.h" class Profile; @@ -43,16 +42,13 @@ class ServiceProcessControl : public IPC::Channel::Sender, virtual void OnGoodDay() = 0; }; - // Construct a ServiceProcessControl with |profile| and a specific |type|. - ServiceProcessControl(Profile* profile, ServiceProcessType type); + // Construct a ServiceProcessControl with |profile|.. + explicit ServiceProcessControl(Profile* profile); virtual ~ServiceProcessControl(); // Return the user profile associated with this service process. Profile* profile() const { return profile_; } - // Return the type of this object. - ServiceProcessType type() const { return type_; } - // Return true if this object is connected to the service. bool is_connected() const { return channel_.get() != NULL; } @@ -114,7 +110,6 @@ class ServiceProcessControl : public IPC::Channel::Sender, void ConnectInternal(Task* task); Profile* profile_; - ServiceProcessType type_; // IPC channel to the service process. scoped_ptr<IPC::SyncChannel> channel_; diff --git a/chrome/browser/service/service_process_control_browsertest.cc b/chrome/browser/service/service_process_control_browsertest.cc index 854a7ab..391f99f 100644 --- a/chrome/browser/service/service_process_control_browsertest.cc +++ b/chrome/browser/service/service_process_control_browsertest.cc @@ -7,7 +7,6 @@ #include "chrome/browser/browser.h" #include "chrome/browser/service/service_process_control.h" #include "chrome/browser/service/service_process_control_manager.h" -#include "chrome/common/service_process_type.h" class ServiceProcessControlBrowserTest : public InProcessBrowserTest, @@ -16,7 +15,7 @@ class ServiceProcessControlBrowserTest void LaunchServiceProcessControl() { ServiceProcessControl* process = ServiceProcessControlManager::instance()->GetProcessControl( - browser()->profile(), kServiceProcessCloudPrint); + browser()->profile()); process_ = process; // Launch the process asynchronously. diff --git a/chrome/browser/service/service_process_control_manager.cc b/chrome/browser/service/service_process_control_manager.cc index 5750970..5e391a8 100644 --- a/chrome/browser/service/service_process_control_manager.cc +++ b/chrome/browser/service/service_process_control_manager.cc @@ -18,7 +18,7 @@ ServiceProcessControlManager::~ServiceProcessControlManager() { } ServiceProcessControl* ServiceProcessControlManager::GetProcessControl( - Profile* profile, ServiceProcessType type) { + Profile* profile) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); // TODO(hclam): We will have different service process for different types of @@ -30,7 +30,7 @@ ServiceProcessControl* ServiceProcessControlManager::GetProcessControl( } // Couldn't find a ServiceProcess so construct a new one. - ServiceProcessControl* process = new ServiceProcessControl(profile, type); + ServiceProcessControl* process = new ServiceProcessControl(profile); process_control_list_.push_back(process); return process; } diff --git a/chrome/browser/service/service_process_control_manager.h b/chrome/browser/service/service_process_control_manager.h index c57f65c..a57c43e 100644 --- a/chrome/browser/service/service_process_control_manager.h +++ b/chrome/browser/service/service_process_control_manager.h @@ -7,8 +7,6 @@ #include <vector> -#include "chrome/common/service_process_type.h" - class Profile; class ServiceProcessControl; @@ -25,12 +23,10 @@ class ServiceProcessControlManager { // Get the ServiceProcess instance corresponding to |profile| and |type|. // If such an instance doesn't exist a new instance is created. // - // There will be at most one ServiceProcess for a |profile| and |type| - // pair. + // There will be at most one ServiceProcess for a |profile|. // // This method should only be accessed on the UI thread. - ServiceProcessControl* GetProcessControl(Profile* profile, - ServiceProcessType type); + ServiceProcessControl* GetProcessControl(Profile* profile); // Destroy all ServiceProcess objects created. void Shutdown(); |