summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 21:26:47 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 21:26:47 +0000
commit9b85081afdc2fbe9a5c309b982458748eb33267c (patch)
tree5d284fb701756ad640e40bb7ff7f74386cd67a23
parentf90b60bc3a80bbe2b1c4b19931a309eb017c9bb1 (diff)
downloadchromium_src-9b85081afdc2fbe9a5c309b982458748eb33267c.zip
chromium_src-9b85081afdc2fbe9a5c309b982458748eb33267c.tar.gz
chromium_src-9b85081afdc2fbe9a5c309b982458748eb33267c.tar.bz2
Wrap GlobalDescriptors singleton in accessor method.
When I switched GlobalDescriptors to using LeakySingletonTraits in r67627, it didn't occur to me I had to fix all users of it. TEST=compiles Review URL: http://codereview.chromium.org/5517006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68518 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/global_descriptors_posix.cc8
-rw-r--r--base/global_descriptors_posix.h3
-rw-r--r--chrome/app/breakpad_linux.cc2
-rw-r--r--chrome/app/chrome_main.cc5
-rw-r--r--chrome/browser/diagnostics/diagnostics_main.cc4
-rw-r--r--chrome/browser/zygote_main_linux.cc2
-rw-r--r--ipc/ipc_channel_posix.cc2
7 files changed, 17 insertions, 9 deletions
diff --git a/base/global_descriptors_posix.cc b/base/global_descriptors_posix.cc
index 8c853a0..2fe953c 100644
--- a/base/global_descriptors_posix.cc
+++ b/base/global_descriptors_posix.cc
@@ -15,6 +15,14 @@ GlobalDescriptors::GlobalDescriptors() {}
GlobalDescriptors::~GlobalDescriptors() {}
+// static
+GlobalDescriptors* GlobalDescriptors::GetInstance() {
+ typedef Singleton<base::GlobalDescriptors,
+ LeakySingletonTraits<base::GlobalDescriptors> >
+ GlobalDescriptorsSingleton;
+ return GlobalDescriptorsSingleton::get();
+}
+
int GlobalDescriptors::MaybeGet(Key key) const {
for (Mapping::const_iterator
i = descriptors_.begin(); i != descriptors_.end(); ++i) {
diff --git a/base/global_descriptors_posix.h b/base/global_descriptors_posix.h
index 8ea743e..ab2b86b 100644
--- a/base/global_descriptors_posix.h
+++ b/base/global_descriptors_posix.h
@@ -41,6 +41,9 @@ class GlobalDescriptors {
// the following constant to the key value:
static const int kBaseDescriptor = 3; // 0, 1, 2 are already taken.
+ // Return the singleton instance of GlobalDescriptors.
+ static GlobalDescriptors* GetInstance();
+
// Get a descriptor given a key. It is a fatal error if the key is not known.
int Get(Key key) const;
// Get a descriptor give a key. Returns -1 on error.
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc
index 1f55a5d..44e6355 100644
--- a/chrome/app/breakpad_linux.cc
+++ b/chrome/app/breakpad_linux.cc
@@ -729,7 +729,7 @@ NonBrowserCrashHandler(const void* crash_context, size_t crash_context_size,
}
void EnableNonBrowserCrashDumping() {
- const int fd = Singleton<base::GlobalDescriptors>()->Get(kCrashDumpSignal);
+ const int fd = base::GlobalDescriptors::GetInstance()->Get(kCrashDumpSignal);
is_crash_reporter_enabled = true;
// We deliberately leak this object.
google_breakpad::ExceptionHandler* handler =
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc
index 41b522e..491366c 100644
--- a/chrome/app/chrome_main.cc
+++ b/chrome/app/chrome_main.cc
@@ -250,10 +250,7 @@ void LowLevelInit() {
SetupSignalHandlers();
- typedef Singleton<base::GlobalDescriptors,
- LeakySingletonTraits<base::GlobalDescriptors> >
- GlobalDescriptorsSingleton;
- base::GlobalDescriptors* g_fds = GlobalDescriptorsSingleton::get();
+ base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance();
g_fds->Set(kPrimaryIPCChannel,
kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor);
#if defined(OS_LINUX)
diff --git a/chrome/browser/diagnostics/diagnostics_main.cc b/chrome/browser/diagnostics/diagnostics_main.cc
index bf88222..2f654c2 100644
--- a/chrome/browser/diagnostics/diagnostics_main.cc
+++ b/chrome/browser/diagnostics/diagnostics_main.cc
@@ -315,8 +315,8 @@ class TestController : public DiagnosticsModel::Observer {
// -(all) RegisterInvalidParamHandler()
// -(all) base::AtExitManager::AtExitManager()
// -(macOS) base::ScopedNSAutoreleasePool
-// -(posix) Singleton<base::GlobalDescriptors>::Set(kPrimaryIPCChannel)
-// -(linux) Singleton<base::GlobalDescriptors>::Set(kCrashDumpSignal)
+// -(posix) base::GlobalDescriptors::GetInstance()->Set(kPrimaryIPCChannel)
+// -(linux) base::GlobalDescriptors::GetInstance()->Set(kCrashDumpSignal)
// -(posix) setlocale(LC_ALL,..)
// -(all) CommandLine::Init();
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index 008d3a4..5943d11 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -382,7 +382,7 @@ class Zygote {
close(kBrowserDescriptor); // our socket from the browser
if (g_suid_sandbox_active)
close(kZygoteIdDescriptor); // another socket from the browser
- Singleton<base::GlobalDescriptors>()->Reset(mapping);
+ base::GlobalDescriptors::GetInstance()->Reset(mapping);
#if defined(CHROMIUM_SELINUX)
SELinuxTransitionToTypeOrDie("chromium_renderer_t");
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index bbf13743..781175e3 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -396,7 +396,7 @@ bool Channel::ChannelImpl::CreatePipe(const std::string& channel_id,
}
used_initial_channel = true;
- pipe_ = Singleton<base::GlobalDescriptors>()->Get(kPrimaryIPCChannel);
+ pipe_ = base::GlobalDescriptors::GetInstance()->Get(kPrimaryIPCChannel);
}
} else {
waiting_connect_ = mode == MODE_SERVER;