diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-31 20:37:59 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-31 20:37:59 +0000 |
commit | fecbc6cac20962ff51d60d2a7726ce3be8f345e4 (patch) | |
tree | 17b433feb1ca9027e0915751ef7935d44a27b86d /base/win | |
parent | 3492fc6d1534eec4418232349cdcd5d36c61a881 (diff) | |
download | chromium_src-fecbc6cac20962ff51d60d2a7726ce3be8f345e4.zip chromium_src-fecbc6cac20962ff51d60d2a7726ce3be8f345e4.tar.gz chromium_src-fecbc6cac20962ff51d60d2a7726ce3be8f345e4.tar.bz2 |
Simplify chrome_exe_main_*.cc, moving as much of the code out as possible. This is in preparation for moving the code in ChromeMain (and associated platform files) to a common place that can be used by both chrome and other embedders of content (i.e. content_shell). Included is a change to make the sandbox code not need an AtExitManager. This is necessary because content_shell would be just one exe, and we'd need to initialize the sandbox before calling ChromeMain, which is what would creat AtExitManager.I removed the code that printed the tcmalloc stacks in the OOM handler (i.e. r33993) under Windows. The issue is I wanted to move the OOM handling code to base to match the other platforms (in a long string of changes to make the startup code more sane, so I can share it with a browser built over content). When I tried moving the tcmalloc code to base, then I ran into a bunch of linker errors because a bunch of targets that depend on base don't depend on allocator. When I tried to add that to base, I ran into strange gyp errors (see patchset 2). I asked Jim/Eric and they said they don't use this data from dumps, and that most of the OOM minimdumps are in v8 heap anyways. When James get back, if he still uses this I can figure out how to put this back.BUG=90445
Review URL: http://codereview.chromium.org/7810005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/win')
-rw-r--r-- | base/win/windows_version.cc | 13 | ||||
-rw-r--r-- | base/win/windows_version.h | 8 |
2 files changed, 16 insertions, 5 deletions
diff --git a/base/win/windows_version.cc b/base/win/windows_version.cc index 8dc2d93..5779074 100644 --- a/base/win/windows_version.cc +++ b/base/win/windows_version.cc @@ -13,7 +13,18 @@ namespace win { // static OSInfo* OSInfo::GetInstance() { - return Singleton<OSInfo>::get(); + // Note: we don't use the Singleton class because it depends on AtExitManager, + // and it's convenient for other modules to use this classs without it. This + // pattern is copied from gurl.cc. + static OSInfo* info; + if (!info) { + OSInfo* new_info = new OSInfo(); + if (InterlockedCompareExchangePointer( + reinterpret_cast<PVOID*>(&info), new_info, NULL)) { + delete new_info; + } + } + return info; } OSInfo::OSInfo() diff --git a/base/win/windows_version.h b/base/win/windows_version.h index 296e0da..920438b 100644 --- a/base/win/windows_version.h +++ b/base/win/windows_version.h @@ -7,7 +7,7 @@ #pragma once #include "base/base_export.h" -#include "base/memory/singleton.h" +#include "base/basictypes.h" typedef void* HANDLE; @@ -27,8 +27,9 @@ enum Version { VERSION_WIN7, }; -// A Singleton that can be used to query various pieces of information about the -// OS and process state. +// A singleton that can be used to query various pieces of information about the +// OS and process state. Note that this doesn't use the base Singleton class, so +// it can be used without an AtExitManager. class BASE_EXPORT OSInfo { public: struct VersionNumber { @@ -92,7 +93,6 @@ class BASE_EXPORT OSInfo { size_t allocation_granularity_; WOW64Status wow64_status_; - friend struct DefaultSingletonTraits<OSInfo>; DISALLOW_COPY_AND_ASSIGN(OSInfo); }; |