Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: chrome/common/service_process_util.h

Issue 5634005: Add a new GetInstance() method for singleton classes under chrome/service and /net. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/service_process_util.cc » ('j') | net/socket_stream/socket_stream_job_manager.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/service_process_util.h
diff --git a/chrome/common/service_process_util.h b/chrome/common/service_process_util.h
index 28304e16dbbc849617b76af49ef8b2d993ef4b53..b0b0bd090705f255beac7e9a21d7bbd4cea4619d 100644
--- a/chrome/common/service_process_util.h
+++ b/chrome/common/service_process_util.h
@@ -10,6 +10,7 @@
#include "base/process.h"
#include "base/scoped_ptr.h"
#include "base/shared_memory.h"
+#include "base/singleton.h"
#include "base/task.h"
// Return the IPC channel to connect to the service process.
@@ -48,11 +49,11 @@ bool ForceServiceProcessShutdown(const std::string& version);
// and this class are shared.
class ServiceProcessState {
public:
- ServiceProcessState();
- ~ServiceProcessState();
+ // Returns the singleton instance.
+ static ServiceProcessState* GetInstance();
// Tries to become the sole service process for the current user data dir.
- // Returns false is another service process is already running.
+ // Returns false if another service process is already running.
bool Initialize();
// Signal that the service process is ready.
@@ -69,7 +70,10 @@ class ServiceProcessState {
// Unregister the service process to run on startup.
bool RemoveFromAutoRun();
+
private:
+ ServiceProcessState();
+ ~ServiceProcessState();
// Create the shared memory data for the service process.
bool CreateSharedData();
@@ -95,6 +99,8 @@ class ServiceProcessState {
struct StateData;
StateData* state_;
scoped_ptr<base::SharedMemory> shared_mem_service_data_;
+
+ friend struct DefaultSingletonTraits<ServiceProcessState>;
};
#endif // CHROME_COMMON_SERVICE_PROCESS_UTIL_H_
« no previous file with comments | « no previous file | chrome/common/service_process_util.cc » ('j') | net/socket_stream/socket_stream_job_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698