Allow linker initialization of lazy instance
Using the initializer list construct = {0} allows the object to be linker initialized. Modify the LazyInstance class design to make it a pod aggregate type that can be linker initialized this way. Also combines the instance and state members, in line with the Singleton<> class design. Introduces a new LAZY_INSTANCE_INITIALIZER macro specifically for using to init all lazy instances + modify all existing callsites to use it. (Old code would no longer compile) BUG=94925 TEST=existing tests pass. http://build.chromium.org/f/chromium/perf/linux-release/sizes/report.html?history=150&header=chrome-si&graph=chrome-si&rev=-1 should step downward. TBR=jam@chromium.org,rvargas@chromium.org,darin@chromium.org,ben@chromium.org,apatrick@chromium.org,akalin@chromium.org Review URL: http://codereview.chromium.org/8491043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110076 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
base
debug
files
i18n
lazy_instance.cclazy_instance.hlazy_instance_unittest.ccmac
message_loop.ccnix
path_service.ccrand_util_posix.ccsys_info_chromeos.ccthird_party
dmg_fp
threading
platform_thread_mac.mmplatform_thread_posix.ccthread.ccthread_restrictions.ccwatchdog.ccworker_pool_posix.cc
tracked_objects.ccchrome
app
browser
automation
chromeos
boot_times_loader.ccchrome_browser_main_chromeos.cc
cros
cros_settings.ccextensions
login
system
web_socket_proxy_controller.ccwm_ipc.cccontent_settings
debugger
download
extensions
external_tab_container_win.ccinternal_auth.ccplugin_prefs.ccprinting
resources_util.ccsafe_browsing
speech
spellchecker
sync
util
tabs
translate
ui
common
default_plugin
installer
renderer
extensions
chrome_v8_extension.ccchrome_webstore_bindings.ccevent_bindings.ccextension_helper.ccmiscellaneous_bindings.ccschema_generated_bindings.cc
safe_browsing
service
cloud_print
chrome_frame
chrome_frame_automation.cccom_type_info_holder.cc
crash_reporting
external_tab.ccmetrics_service.cctest
urlmon_moniker.ccutils.cccontent
browser
browser_child_process_host.ccbrowser_thread_impl.ccbrowsing_instance.cc
debugger
gpu
in_process_webkit
mock_resource_context.ccnet
notification_service_impl.ccrenderer_host
speech
common
plugin
public
renderer
worker
crypto
ipc
jingle/glue
net
base
bandwidth_metrics.cccert_database_nss_unittest.ccdns_reloader.ccev_root_ca_metadata.ccmime_util.ccnet_util.ccssl_config_service.cctest_root_certs.cctest_root_certs_win.ccwinsock_init.ccx509_certificate.ccx509_certificate_win.cc
disk_cache
ocsp
proxy
socket
client_socket_factory.ccdns_cert_provenance_checker.ccnss_ssl_util.ccssl_client_socket_mac.ccssl_client_socket_win.cc
third_party
mozilla_security_manager
tools
fetch
url_request
websockets
printing
remoting
client
plugin
host
third_party/leveldatabase
ui
base
gfx
webkit
@ -61,7 +61,7 @@ int g_category_index = 3; // skip initial 3 categories
|
||||
// The most-recently captured name of the current thread
|
||||
LazyInstance<ThreadLocalPointer<char>,
|
||||
LeakyLazyInstanceTraits<ThreadLocalPointer<char> > >
|
||||
g_current_thread_name(LINKER_INITIALIZED);
|
||||
g_current_thread_name = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -218,8 +218,8 @@ class InotifyReaderTask : public Task {
|
||||
DISALLOW_COPY_AND_ASSIGN(InotifyReaderTask);
|
||||
};
|
||||
|
||||
static base::LazyInstance<InotifyReader> g_inotify_reader(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<InotifyReader> g_inotify_reader =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
InotifyReader::InotifyReader()
|
||||
: thread_("inotify_reader"),
|
||||
|
@ -36,8 +36,10 @@ struct NumberFormatWrapper {
|
||||
scoped_ptr<icu::NumberFormat> number_format;
|
||||
};
|
||||
|
||||
LazyInstance<NumberFormatWrapper> g_number_format_int(LINKER_INITIALIZED);
|
||||
LazyInstance<NumberFormatWrapper> g_number_format_float(LINKER_INITIALIZED);
|
||||
LazyInstance<NumberFormatWrapper> g_number_format_int =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
LazyInstance<NumberFormatWrapper> g_number_format_float =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -11,15 +11,18 @@
|
||||
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
|
||||
|
||||
namespace base {
|
||||
namespace internal {
|
||||
|
||||
bool LazyInstanceHelper::NeedsInstance() {
|
||||
// Try to create the instance, if we're the first, will go from EMPTY
|
||||
// to CREATING, otherwise we've already been beaten here.
|
||||
// The memory access has no memory ordering as STATE_EMPTY and STATE_CREATING
|
||||
// has no associated data (memory barriers are all about ordering
|
||||
// of memory accesses to *associated* data).
|
||||
if (base::subtle::NoBarrier_CompareAndSwap(
|
||||
&state_, STATE_EMPTY, STATE_CREATING) == STATE_EMPTY)
|
||||
// TODO(joth): This function could be shared with Singleton, in place of its
|
||||
// WaitForInstance() call.
|
||||
bool NeedsLazyInstance(subtle::AtomicWord* state) {
|
||||
// Try to create the instance, if we're the first, will go from 0 to
|
||||
// kLazyInstanceStateCreating, otherwise we've already been beaten here.
|
||||
// The memory access has no memory ordering as state 0 and
|
||||
// kLazyInstanceStateCreating have no associated data (memory barriers are
|
||||
// all about ordering of memory accesses to *associated* data).
|
||||
if (subtle::NoBarrier_CompareAndSwap(state, 0,
|
||||
kLazyInstanceStateCreating) == 0)
|
||||
// Caller must create instance
|
||||
return true;
|
||||
|
||||
@ -27,29 +30,30 @@ bool LazyInstanceHelper::NeedsInstance() {
|
||||
// The load has acquire memory ordering as a thread which sees
|
||||
// state_ == STATE_CREATED needs to acquire visibility over
|
||||
// the associated data (buf_). Pairing Release_Store is in
|
||||
// CompleteInstance().
|
||||
while (base::subtle::Acquire_Load(&state_) != STATE_CREATED)
|
||||
// CompleteLazyInstance().
|
||||
while (subtle::Acquire_Load(state) == kLazyInstanceStateCreating) {
|
||||
PlatformThread::YieldCurrentThread();
|
||||
|
||||
}
|
||||
// Someone else created the instance.
|
||||
return false;
|
||||
}
|
||||
|
||||
void LazyInstanceHelper::CompleteInstance(void* instance, void (*dtor)(void*)) {
|
||||
void CompleteLazyInstance(subtle::AtomicWord* state,
|
||||
subtle::AtomicWord new_instance,
|
||||
void* lazy_instance,
|
||||
void (*dtor)(void*)) {
|
||||
// See the comment to the corresponding HAPPENS_AFTER in Pointer().
|
||||
ANNOTATE_HAPPENS_BEFORE(&state_);
|
||||
ANNOTATE_HAPPENS_BEFORE(state);
|
||||
|
||||
// Instance is created, go from CREATING to CREATED.
|
||||
// Releases visibility over buf_ to readers. Pairing Acquire_Load's are in
|
||||
// NeedsInstance() and Pointer().
|
||||
base::subtle::Release_Store(&state_, STATE_CREATED);
|
||||
// Releases visibility over private_buf_ to readers. Pairing Acquire_Load's
|
||||
// are in NeedsInstance() and Pointer().
|
||||
subtle::Release_Store(state, new_instance);
|
||||
|
||||
// Make sure that the lazily instantiated object will get destroyed at exit.
|
||||
if (dtor)
|
||||
base::AtExitManager::RegisterCallback(dtor, instance);
|
||||
AtExitManager::RegisterCallback(dtor, lazy_instance);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace base
|
||||
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// LazyInstance is completely thread safe, assuming that you create it safely.
|
||||
// The class was designed to be POD initialized, so it shouldn't require a
|
||||
// static constructor. It really only makes sense to declare a LazyInstance as
|
||||
// a global variable using the base::LinkerInitialized constructor.
|
||||
// a global variable using the LAZY_INSTANCE_INITIALIZER initializer.
|
||||
//
|
||||
// LazyInstance is similar to Singleton, except it does not have the singleton
|
||||
// property. You can have multiple LazyInstance's of the same type, and each
|
||||
@ -24,7 +24,7 @@
|
||||
// requires that Type be a complete type so we can determine the size.
|
||||
//
|
||||
// Example usage:
|
||||
// static LazyInstance<MyClass> my_instance(base::LINKER_INITIALIZED);
|
||||
// static LazyInstance<MyClass> my_instance = LAZY_INSTANCE_INITIALIZER;
|
||||
// void SomeMethod() {
|
||||
// my_instance.Get().SomeMethod(); // MyClass::SomeMethod()
|
||||
//
|
||||
@ -45,6 +45,12 @@
|
||||
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
|
||||
// LazyInstance uses its own struct initializer-list style static
|
||||
// initialization, as base's LINKER_INITIALIZED requires a constructor and on
|
||||
// some compilers (notably gcc 4.4) this still ends up needing runtime
|
||||
// initialization.
|
||||
#define LAZY_INSTANCE_INITIALIZER {0}
|
||||
|
||||
namespace base {
|
||||
|
||||
template <typename Type>
|
||||
@ -79,53 +85,36 @@ struct LeakyLazyInstanceTraits {
|
||||
}
|
||||
};
|
||||
|
||||
// We pull out some of the functionality into a non-templated base, so that we
|
||||
// We pull out some of the functionality into non-templated functions, so we
|
||||
// can implement the more complicated pieces out of line in the .cc file.
|
||||
class BASE_EXPORT LazyInstanceHelper {
|
||||
protected:
|
||||
enum {
|
||||
STATE_EMPTY = 0,
|
||||
STATE_CREATING = 1,
|
||||
STATE_CREATED = 2
|
||||
};
|
||||
namespace internal {
|
||||
|
||||
explicit LazyInstanceHelper(LinkerInitialized /*unused*/) {/* state_ is 0 */}
|
||||
// Our AtomicWord doubles as a spinlock, where a value of
|
||||
// kBeingCreatedMarker means the spinlock is being held for creation.
|
||||
static const subtle::AtomicWord kLazyInstanceStateCreating = 1;
|
||||
|
||||
// Declaring a destructor (even if it's empty) will cause MSVC to register a
|
||||
// static initializer to register the empty destructor with atexit().
|
||||
// Check if instance needs to be created. If so return true otherwise
|
||||
// if another thread has beat us, wait for instance to be created and
|
||||
// return false.
|
||||
BASE_EXPORT bool NeedsLazyInstance(subtle::AtomicWord* state);
|
||||
|
||||
// A destructor is intentionally not defined. If we were to say
|
||||
// ~LazyInstanceHelper() { }
|
||||
// Even though it's empty, a destructor will still be generated.
|
||||
// In order for the constructor to be called for static variables,
|
||||
// it will be registered as a callback at runtime with AtExit().
|
||||
// We don't want this, so we don't declare a destructor at all,
|
||||
// effectively keeping the type POD (at least in terms of
|
||||
// initialization and destruction).
|
||||
// After creating an instance, call this to register the dtor to be called
|
||||
// at program exit and to update the atomic state to hold the |new_instance|
|
||||
BASE_EXPORT void CompleteLazyInstance(subtle::AtomicWord* state,
|
||||
subtle::AtomicWord new_instance,
|
||||
void* lazy_instance,
|
||||
void (*dtor)(void*));
|
||||
|
||||
// Check if instance needs to be created. If so return true otherwise
|
||||
// if another thread has beat us, wait for instance to be created and
|
||||
// return false.
|
||||
bool NeedsInstance();
|
||||
|
||||
// After creating an instance, call this to register the dtor to be called
|
||||
// at program exit and to update the state to STATE_CREATED.
|
||||
void CompleteInstance(void* instance, void (*dtor)(void*));
|
||||
|
||||
base::subtle::Atomic32 state_;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(LazyInstanceHelper);
|
||||
};
|
||||
} // namespace internal
|
||||
|
||||
template <typename Type, typename Traits = DefaultLazyInstanceTraits<Type> >
|
||||
class LazyInstance : public LazyInstanceHelper {
|
||||
class LazyInstance {
|
||||
public:
|
||||
explicit LazyInstance(LinkerInitialized x) : LazyInstanceHelper(x) { }
|
||||
|
||||
// Declaring a destructor (even if it's empty) will cause MSVC to register a
|
||||
// static initializer to register the empty destructor with atexit().
|
||||
// Refer to the destructor-related comment in LazyInstanceHelper.
|
||||
// Do not define a destructor, as doing so makes LazyInstance a
|
||||
// non-POD-struct. We don't want that because then a static initializer will
|
||||
// be created to register the (empty) destructor with atexit() under MSVC, for
|
||||
// example. We handle destruction of the contained Type class explicitly via
|
||||
// the OnExit member function, where needed.
|
||||
// ~LazyInstance() {}
|
||||
|
||||
Type& Get() {
|
||||
@ -136,61 +125,72 @@ class LazyInstance : public LazyInstanceHelper {
|
||||
#ifndef NDEBUG
|
||||
// Avoid making TLS lookup on release builds.
|
||||
if (!Traits::kAllowedToAccessOnNonjoinableThread)
|
||||
base::ThreadRestrictions::AssertSingletonAllowed();
|
||||
ThreadRestrictions::AssertSingletonAllowed();
|
||||
#endif
|
||||
// If any bit in the created mask is true, the instance has already been
|
||||
// fully constructed.
|
||||
static const subtle::AtomicWord kLazyInstanceCreatedMask =
|
||||
~internal::kLazyInstanceStateCreating;
|
||||
|
||||
// We will hopefully have fast access when the instance is already created.
|
||||
// Since a thread sees state_ != STATE_CREATED at most once,
|
||||
// the load is taken out of NeedsInstance() as a fast-path.
|
||||
// Since a thread sees private_instance_ == 0 or kLazyInstanceStateCreating
|
||||
// at most once, the load is taken out of NeedsInstance() as a fast-path.
|
||||
// The load has acquire memory ordering as a thread which sees
|
||||
// state_ == STATE_CREATED needs to acquire visibility over
|
||||
// the associated data (buf_). Pairing Release_Store is in
|
||||
// CompleteInstance().
|
||||
if ((base::subtle::Acquire_Load(&state_) != STATE_CREATED) &&
|
||||
NeedsInstance()) {
|
||||
// Create the instance in the space provided by |buf_|.
|
||||
instance_ = Traits::New(buf_);
|
||||
CompleteInstance(this, Traits::kRegisterOnExit ? OnExit : NULL);
|
||||
// private_instance_ > creating needs to acquire visibility over
|
||||
// the associated data (private_buf_). Pairing Release_Store is in
|
||||
// CompleteLazyInstance().
|
||||
subtle::AtomicWord value = subtle::Acquire_Load(&private_instance_);
|
||||
if (!(value & kLazyInstanceCreatedMask) &&
|
||||
internal::NeedsLazyInstance(&private_instance_)) {
|
||||
// Create the instance in the space provided by |private_buf_|.
|
||||
value = reinterpret_cast<subtle::AtomicWord>(Traits::New(private_buf_));
|
||||
internal::CompleteLazyInstance(&private_instance_, value, this,
|
||||
Traits::kRegisterOnExit ? OnExit : NULL);
|
||||
}
|
||||
|
||||
// This annotation helps race detectors recognize correct lock-less
|
||||
// synchronization between different threads calling Pointer().
|
||||
// We suggest dynamic race detection tool that "Traits::New" above
|
||||
// and CompleteInstance(...) happens before "return instance_" below.
|
||||
// See the corresponding HAPPENS_BEFORE in CompleteInstance(...).
|
||||
ANNOTATE_HAPPENS_AFTER(&state_);
|
||||
return instance_;
|
||||
// and CompleteLazyInstance(...) happens before "return instance()" below.
|
||||
// See the corresponding HAPPENS_BEFORE in CompleteLazyInstance(...).
|
||||
ANNOTATE_HAPPENS_AFTER(&private_instance_);
|
||||
return instance();
|
||||
}
|
||||
|
||||
bool operator==(Type* p) {
|
||||
switch (base::subtle::NoBarrier_Load(&state_)) {
|
||||
case STATE_EMPTY:
|
||||
switch (subtle::NoBarrier_Load(&private_instance_)) {
|
||||
case 0:
|
||||
return p == NULL;
|
||||
case STATE_CREATING:
|
||||
return static_cast<int8*>(static_cast<void*>(p)) == buf_;
|
||||
case STATE_CREATED:
|
||||
return p == instance_;
|
||||
case internal::kLazyInstanceStateCreating:
|
||||
return static_cast<int8*>(static_cast<void*>(p)) == private_buf_;
|
||||
default:
|
||||
return false;
|
||||
return p == instance();
|
||||
}
|
||||
}
|
||||
|
||||
// Effectively private: member data is only public to allow the linker to
|
||||
// statically initialize it. DO NOT USE FROM OUTSIDE THIS CLASS.
|
||||
|
||||
// Note this must use AtomicWord, not Atomic32, to ensure correct alignment
|
||||
// of |private_buf_| on 64 bit architectures. (This member must be first to
|
||||
// allow the syntax used in LAZY_INSTANCE_INITIALIZER to work correctly.)
|
||||
subtle::AtomicWord private_instance_;
|
||||
int8 private_buf_[sizeof(Type)]; // Preallocated space for the Type instance.
|
||||
|
||||
private:
|
||||
Type* instance() {
|
||||
return reinterpret_cast<Type*>(subtle::NoBarrier_Load(&private_instance_));
|
||||
}
|
||||
|
||||
// Adapter function for use with AtExit. This should be called single
|
||||
// threaded, so don't synchronize across threads.
|
||||
// Calling OnExit while the instance is in use by other threads is a mistake.
|
||||
static void OnExit(void* lazy_instance) {
|
||||
LazyInstance<Type, Traits>* me =
|
||||
reinterpret_cast<LazyInstance<Type, Traits>*>(lazy_instance);
|
||||
Traits::Delete(me->instance_);
|
||||
me->instance_ = NULL;
|
||||
base::subtle::Release_Store(&me->state_, STATE_EMPTY);
|
||||
Traits::Delete(me->instance());
|
||||
subtle::Release_Store(&me->private_instance_, 0);
|
||||
}
|
||||
|
||||
Type *instance_;
|
||||
int8 buf_[sizeof(Type)]; // Preallocate the space for the Type instance.
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(LazyInstance);
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2008 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2011 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.
|
||||
|
||||
@ -56,8 +56,8 @@ class SlowDelegate : public base::DelegateSimpleThread::Delegate {
|
||||
|
||||
} // namespace
|
||||
|
||||
static base::LazyInstance<ConstructAndDestructLogger> lazy_logger(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<ConstructAndDestructLogger> lazy_logger =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
TEST(LazyInstanceTest, Basic) {
|
||||
{
|
||||
@ -78,7 +78,8 @@ TEST(LazyInstanceTest, Basic) {
|
||||
EXPECT_EQ(4, destructed_seq_.GetNext());
|
||||
}
|
||||
|
||||
static base::LazyInstance<SlowConstructor> lazy_slow(base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<SlowConstructor> lazy_slow =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
TEST(LazyInstanceTest, ConstructorThreadSafety) {
|
||||
{
|
||||
@ -122,7 +123,7 @@ TEST(LazyInstanceTest, LeakyLazyInstance) {
|
||||
bool deleted1 = false;
|
||||
{
|
||||
base::ShadowingAtExitManager shadow;
|
||||
static base::LazyInstance<DeleteLogger> test(base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<DeleteLogger> test = LAZY_INSTANCE_INITIALIZER;
|
||||
test.Get().SetDeletedPtr(&deleted1);
|
||||
}
|
||||
EXPECT_TRUE(deleted1);
|
||||
@ -134,7 +135,7 @@ TEST(LazyInstanceTest, LeakyLazyInstance) {
|
||||
base::ShadowingAtExitManager shadow;
|
||||
static base::LazyInstance<DeleteLogger,
|
||||
base::LeakyLazyInstanceTraits<DeleteLogger> >
|
||||
test(base::LINKER_INITIALIZED);
|
||||
test = LAZY_INSTANCE_INITIALIZER;
|
||||
test.Get().SetDeletedPtr(&deleted2);
|
||||
}
|
||||
EXPECT_FALSE(deleted2);
|
||||
|
@ -16,7 +16,7 @@ namespace {
|
||||
|
||||
// Whether to allow NSExceptions to be raised on the current thread.
|
||||
LazyInstance<ThreadLocalBoolean, LeakyLazyInstanceTraits<ThreadLocalBoolean> >
|
||||
g_exceptionsAllowed(base::LINKER_INITIALIZED);
|
||||
g_exceptionsAllowed = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -42,8 +42,8 @@ namespace {
|
||||
|
||||
// A lazily created thread local storage for quick access to a thread's message
|
||||
// loop, if one exists. This should be safe and free of static constructors.
|
||||
base::LazyInstance<base::ThreadLocalPointer<MessageLoop> > lazy_tls_ptr(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<base::ThreadLocalPointer<MessageLoop> > lazy_tls_ptr =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// Logical events for Histogram profiling. Run with -message-loop-histogrammer
|
||||
// to get an accounting of messages and actions taken on each thread.
|
||||
|
@ -35,7 +35,7 @@ namespace {
|
||||
// this lock.
|
||||
static base::LazyInstance<base::Lock,
|
||||
base::LeakyLazyInstanceTraits<base::Lock> >
|
||||
g_mime_util_xdg_lock(base::LINKER_INITIALIZED);
|
||||
g_mime_util_xdg_lock = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
class IconTheme;
|
||||
|
||||
|
@ -134,7 +134,7 @@ struct PathData {
|
||||
}
|
||||
};
|
||||
|
||||
static base::LazyInstance<PathData> g_path_data(base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<PathData> g_path_data = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
static PathData* GetPathData() {
|
||||
return g_path_data.Pointer();
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2008 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2011 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.
|
||||
|
||||
@ -36,7 +36,7 @@ class URandomFd {
|
||||
int fd_;
|
||||
};
|
||||
|
||||
base::LazyInstance<URandomFd> g_urandom_fd(base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<URandomFd> g_urandom_fd = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -40,7 +40,7 @@ struct ChromeOSVersionNumbers {
|
||||
};
|
||||
|
||||
static base::LazyInstance<ChromeOSVersionNumbers>
|
||||
g_chrome_os_version_numbers(base::LINKER_INITIALIZED);
|
||||
g_chrome_os_version_numbers = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// static
|
||||
void SysInfo::OperatingSystemVersionNumbers(int32* major_version,
|
||||
|
4
base/third_party/dmg_fp/dtoa_wrapper.cc
vendored
4
base/third_party/dmg_fp/dtoa_wrapper.cc
vendored
@ -12,10 +12,10 @@
|
||||
// A single lock would lead to an attempted recursive grab.
|
||||
static base::LazyInstance<base::Lock,
|
||||
base::LeakyLazyInstanceTraits<base::Lock> >
|
||||
dtoa_lock_0(base::LINKER_INITIALIZED);
|
||||
dtoa_lock_0 = LAZY_INSTANCE_INITIALIZER;
|
||||
static base::LazyInstance<base::Lock,
|
||||
base::LeakyLazyInstanceTraits<base::Lock> >
|
||||
dtoa_lock_1(base::LINKER_INITIALIZED);
|
||||
dtoa_lock_1 = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
/*
|
||||
* This define and the code below is to trigger thread-safe behavior
|
||||
|
@ -20,7 +20,7 @@ namespace {
|
||||
|
||||
LazyInstance<ThreadLocalPointer<char>,
|
||||
LeakyLazyInstanceTraits<ThreadLocalPointer<char> > >
|
||||
current_thread_name(LINKER_INITIALIZED);
|
||||
current_thread_name = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace {
|
||||
// Mac name code is in in platform_thread_mac.mm.
|
||||
LazyInstance<ThreadLocalPointer<char>,
|
||||
LeakyLazyInstanceTraits<ThreadLocalPointer<char> > >
|
||||
current_thread_name(LINKER_INITIALIZED);
|
||||
current_thread_name = LAZY_INSTANCE_INITIALIZER;
|
||||
#endif
|
||||
|
||||
struct ThreadParams {
|
||||
|
@ -17,8 +17,8 @@ namespace {
|
||||
// because its Stop method was called. This allows us to catch cases where
|
||||
// MessageLoop::Quit() is called directly, which is unexpected when using a
|
||||
// Thread to setup and run a MessageLoop.
|
||||
base::LazyInstance<base::ThreadLocalBoolean> lazy_tls_bool(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<base::ThreadLocalBoolean> lazy_tls_bool =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2011 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.
|
||||
|
||||
@ -16,10 +16,10 @@ namespace base {
|
||||
namespace {
|
||||
|
||||
LazyInstance<ThreadLocalBoolean, LeakyLazyInstanceTraits<ThreadLocalBoolean> >
|
||||
g_io_disallowed(LINKER_INITIALIZED);
|
||||
g_io_disallowed = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
LazyInstance<ThreadLocalBoolean, LeakyLazyInstanceTraits<ThreadLocalBoolean> >
|
||||
g_singleton_disallowed(LINKER_INITIALIZED);
|
||||
g_singleton_disallowed = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
@ -21,8 +21,8 @@ namespace {
|
||||
// on alarms from callers that specify old times.
|
||||
|
||||
// Lock for access of static data...
|
||||
LazyInstance<Lock, LeakyLazyInstanceTraits<Lock> > g_static_lock(
|
||||
LINKER_INITIALIZED);
|
||||
LazyInstance<Lock, LeakyLazyInstanceTraits<Lock> > g_static_lock =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// When did we last alarm and get stuck (for a while) in a debugger?
|
||||
TimeTicks g_last_debugged_alarm_time;
|
||||
|
@ -57,7 +57,8 @@ void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here,
|
||||
pool_->PostTask(from_here, task);
|
||||
}
|
||||
|
||||
base::LazyInstance<WorkerPoolImpl> g_lazy_worker_pool(base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<WorkerPoolImpl> g_lazy_worker_pool =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
class WorkerThread : public PlatformThread::Delegate {
|
||||
public:
|
||||
|
@ -167,7 +167,7 @@ ThreadData::ThreadDataPool* ThreadData::unregistered_thread_data_pool_ = NULL;
|
||||
// static
|
||||
base::LazyInstance<base::Lock,
|
||||
base::LeakyLazyInstanceTraits<base::Lock> >
|
||||
ThreadData::list_lock_(base::LINKER_INITIALIZED);
|
||||
ThreadData::list_lock_ = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// static
|
||||
ThreadData::Status ThreadData::status_ = ThreadData::UNINITIALIZED;
|
||||
|
@ -97,13 +97,13 @@
|
||||
#endif
|
||||
|
||||
base::LazyInstance<chrome::ChromeContentBrowserClient>
|
||||
g_chrome_content_browser_client(base::LINKER_INITIALIZED);
|
||||
g_chrome_content_browser_client = LAZY_INSTANCE_INITIALIZER;
|
||||
base::LazyInstance<chrome::ChromeContentRendererClient>
|
||||
g_chrome_content_renderer_client(base::LINKER_INITIALIZED);
|
||||
g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER;
|
||||
base::LazyInstance<chrome::ChromeContentUtilityClient>
|
||||
g_chrome_content_utility_client(base::LINKER_INITIALIZED);
|
||||
g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER;
|
||||
base::LazyInstance<chrome::ChromeContentPluginClient>
|
||||
g_chrome_content_plugin_client(base::LINKER_INITIALIZED);
|
||||
g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
extern int NaClMain(const content::MainFunctionParams&);
|
||||
extern int ServiceProcessMain(const content::MainFunctionParams&);
|
||||
|
@ -24,12 +24,12 @@
|
||||
using content::BrowserThread;
|
||||
|
||||
base::LazyInstance<AutomationResourceMessageFilter::RenderViewMap>
|
||||
AutomationResourceMessageFilter::filtered_render_views_(
|
||||
base::LINKER_INITIALIZED);
|
||||
AutomationResourceMessageFilter::filtered_render_views_ =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
base::LazyInstance<AutomationResourceMessageFilter::CompletionCallbackMap>
|
||||
AutomationResourceMessageFilter::completion_callback_map_(
|
||||
base::LINKER_INITIALIZED);
|
||||
AutomationResourceMessageFilter::completion_callback_map_ =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
int AutomationResourceMessageFilter::unique_request_id_ = 1;
|
||||
int AutomationResourceMessageFilter::next_completion_callback_id_ = 0;
|
||||
|
@ -101,8 +101,8 @@ static const FilePath::CharType kLoginTimes[] = FPL("login-times");
|
||||
// Name of file collecting logout times.
|
||||
static const char kLogoutTimes[] = "logout-times";
|
||||
|
||||
static base::LazyInstance<BootTimesLoader> g_boot_times_loader(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<BootTimesLoader> g_boot_times_loader =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
BootTimesLoader::BootTimesLoader()
|
||||
: backend_(new Backend()),
|
||||
|
@ -72,8 +72,8 @@ class MessageLoopObserver : public MessageLoopForUI::Observer {
|
||||
#endif
|
||||
};
|
||||
|
||||
static base::LazyInstance<MessageLoopObserver> g_message_loop_observer(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<MessageLoopObserver> g_message_loop_observer =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos(
|
||||
const content::MainFunctionParams& parameters)
|
||||
|
@ -87,8 +87,8 @@ class OncNetworkParserTest : public testing::Test {
|
||||
};
|
||||
|
||||
// static
|
||||
base::LazyInstance<ScopedTempDir> OncNetworkParserTest::temp_db_dir_(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<ScopedTempDir> OncNetworkParserTest::temp_db_dir_ =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
TEST_F(OncNetworkParserTest, TestCreateNetworkWifi1) {
|
||||
std::string test_blob(
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
namespace chromeos {
|
||||
|
||||
static base::LazyInstance<CrosSettings> g_cros_settings(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<CrosSettings> g_cros_settings =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
CrosSettings* CrosSettings::Get() {
|
||||
// TODO(xiyaun): Use real stuff when underlying libcros is ready.
|
||||
|
@ -42,7 +42,7 @@ class InputMethodPrivateExtensionsWhitelist {
|
||||
};
|
||||
|
||||
base::LazyInstance<InputMethodPrivateExtensionsWhitelist>
|
||||
g_input_method_private_extensions_whitelist(base::LINKER_INITIALIZED);
|
||||
g_input_method_private_extensions_whitelist = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -19,8 +19,8 @@ using content::BrowserThread;
|
||||
|
||||
namespace chromeos {
|
||||
|
||||
static base::LazyInstance<OwnershipService> g_ownership_service(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<OwnershipService> g_ownership_service =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// static
|
||||
OwnershipService* OwnershipService::GetSharedInstance() {
|
||||
|
@ -175,8 +175,8 @@ class ScreenLockObserver : public chromeos::ScreenLockLibrary::Observer,
|
||||
DISALLOW_COPY_AND_ASSIGN(ScreenLockObserver);
|
||||
};
|
||||
|
||||
static base::LazyInstance<ScreenLockObserver> g_screen_lock_observer(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<ScreenLockObserver> g_screen_lock_observer =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -331,7 +331,7 @@ class SignedSettingsHelperImpl : public SignedSettingsHelper,
|
||||
};
|
||||
|
||||
static base::LazyInstance<SignedSettingsHelperImpl>
|
||||
g_signed_settings_helper_impl(base::LINKER_INITIALIZED);
|
||||
g_signed_settings_helper_impl = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
SignedSettingsHelperImpl::SignedSettingsHelperImpl() {
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ const int kStubDefaultImageIndex = 0;
|
||||
// Delay betweeen user login and attempt to update user's profile image.
|
||||
const long kProfileImageDownloadDelayMs = 10000;
|
||||
|
||||
base::LazyInstance<UserManager> g_user_manager(base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<UserManager> g_user_manager = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// Used to handle the asynchronous response of deleting a cryptohome directory.
|
||||
class RemoveAttempt : public CryptohomeLibrary::Delegate {
|
||||
|
@ -44,8 +44,8 @@ class UdevInfoProviderImpl : public UdevInfoProvider {
|
||||
DISALLOW_COPY_AND_ASSIGN(UdevInfoProviderImpl);
|
||||
};
|
||||
|
||||
base::LazyInstance<UdevInfoProviderImpl> g_udev_info_provider(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<UdevInfoProviderImpl> g_udev_info_provider =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
bool UdevInfoProviderImpl::QueryDeviceProperty(const std::string& sys_path,
|
||||
const std::string& property_name,
|
||||
|
@ -96,7 +96,7 @@ class OriginValidator {
|
||||
std::vector<std::string> allowed_origins_;
|
||||
};
|
||||
|
||||
base::LazyInstance<OriginValidator> g_validator(base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<OriginValidator> g_validator = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
class ProxyTask : public Task {
|
||||
virtual void Run() OVERRIDE;
|
||||
@ -154,7 +154,7 @@ class ProxyLifetime
|
||||
friend class chromeos::WebSocketProxyController;
|
||||
};
|
||||
|
||||
base::LazyInstance<ProxyLifetime> g_proxy_lifetime(base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<ProxyLifetime> g_proxy_lifetime = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
void ProxyTask::Run() {
|
||||
LOG(INFO) << "Attempt to run web socket proxy task";
|
||||
|
@ -74,7 +74,7 @@ bool SetIntArrayProperty(XID xid,
|
||||
|
||||
} // namespace
|
||||
|
||||
static base::LazyInstance<WmIpc> g_wm_ipc(base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<WmIpc> g_wm_ipc = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// static
|
||||
WmIpc* WmIpc::instance() {
|
||||
|
@ -34,8 +34,8 @@ using content::BrowserThread;
|
||||
|
||||
namespace {
|
||||
typedef std::list<TabSpecificContentSettings*> TabSpecificList;
|
||||
static base::LazyInstance<TabSpecificList> g_tab_specific(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<TabSpecificList> g_tab_specific =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
}
|
||||
|
||||
bool TabSpecificContentSettings::LocalSharedObjectsContainer::empty() const {
|
||||
|
@ -19,7 +19,7 @@ namespace {
|
||||
|
||||
base::LazyInstance<FilePath,
|
||||
base::LeakyLazyInstanceTraits<FilePath> >
|
||||
g_last_save_path(base::LINKER_INITIALIZED);
|
||||
g_last_save_path = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
class SaveAsDialog : public SelectFileDialog::Listener,
|
||||
public base::RefCounted<SaveAsDialog> {
|
||||
|
@ -109,7 +109,7 @@ class DefaultDownloadDirectory {
|
||||
};
|
||||
|
||||
static base::LazyInstance<DefaultDownloadDirectory>
|
||||
g_default_download_directory(base::LINKER_INITIALIZED);
|
||||
g_default_download_directory = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
const FilePath& GetDefaultDownloadDirectory() {
|
||||
return g_default_download_directory.Get().path();
|
||||
|
@ -53,7 +53,7 @@ struct Whitelist {
|
||||
};
|
||||
|
||||
static base::LazyInstance<Whitelist>
|
||||
g_whitelisted_install_data(base::LINKER_INITIALIZED);
|
||||
g_whitelisted_install_data = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -41,7 +41,8 @@ const char kDescriptionStylesOffset[] = "offset";
|
||||
const char kDescriptionStylesLength[] = "length";
|
||||
|
||||
static base::LazyInstance<PropertyAccessor<ExtensionOmniboxSuggestion> >
|
||||
g_extension_omnibox_suggestion_property_accessor(base::LINKER_INITIALIZED);
|
||||
g_extension_omnibox_suggestion_property_accessor =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
PropertyAccessor<ExtensionOmniboxSuggestion>& GetPropertyAccessor() {
|
||||
return g_extension_omnibox_suggestion_property_accessor.Get();
|
||||
|
@ -29,8 +29,8 @@ namespace {
|
||||
|
||||
typedef std::map<TabContents*, ExtensionWebNavigationTabObserver*>
|
||||
TabObserverMap;
|
||||
static base::LazyInstance<TabObserverMap> g_tab_observer(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<TabObserverMap> g_tab_observer =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// URL schemes for which we'll send events.
|
||||
const char* kValidSchemes[] = {
|
||||
|
@ -121,7 +121,7 @@ class ExternalTabPageInfoBubbleView : public PageInfoBubbleView {
|
||||
};
|
||||
|
||||
base::LazyInstance<ExternalTabContainer::PendingTabs>
|
||||
ExternalTabContainer::pending_tabs_(base::LINKER_INITIALIZED);
|
||||
ExternalTabContainer::pending_tabs_ = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
ExternalTabContainer::ExternalTabContainer(
|
||||
AutomationProvider* automation, AutomationResourceMessageFilter* filter)
|
||||
|
@ -325,10 +325,10 @@ class InternalAuthVerificationService {
|
||||
namespace {
|
||||
|
||||
static base::LazyInstance<browser::InternalAuthVerificationService>
|
||||
g_verification_service(base::LINKER_INITIALIZED);
|
||||
g_verification_service = LAZY_INSTANCE_INITIALIZER;
|
||||
static base::LazyInstance<base::Lock,
|
||||
base::LeakyLazyInstanceTraits<base::Lock> >
|
||||
g_verification_service_lock(base::LINKER_INITIALIZED);
|
||||
g_verification_service_lock = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -433,7 +433,7 @@ class InternalAuthGenerationService : public base::ThreadChecker {
|
||||
namespace {
|
||||
|
||||
static base::LazyInstance<browser::InternalAuthGenerationService>
|
||||
g_generation_service(base::LINKER_INITIALIZED);
|
||||
g_generation_service = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -41,8 +41,8 @@ namespace {
|
||||
|
||||
// Default state for a plug-in (not state of the default plug-in!).
|
||||
// Accessed only on the UI thread.
|
||||
base::LazyInstance<std::map<FilePath, bool> > g_default_plugin_state(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<std::map<FilePath, bool> > g_default_plugin_state =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -40,7 +40,7 @@ struct PrintingSequencePathMap {
|
||||
|
||||
// No locking, only access on the FILE thread.
|
||||
static base::LazyInstance<PrintingSequencePathMap>
|
||||
g_printing_file_descriptor_map(base::LINKER_INITIALIZED);
|
||||
g_printing_file_descriptor_map = LAZY_INSTANCE_INITIALIZER;
|
||||
#endif
|
||||
|
||||
void RenderParamsFromPrintSettings(const printing::PrintSettings& settings,
|
||||
|
@ -41,7 +41,7 @@ class ThemeMap {
|
||||
StringIntMap id_map_;
|
||||
};
|
||||
|
||||
static base::LazyInstance<ThemeMap> g_theme_ids(base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<ThemeMap> g_theme_ids = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -54,7 +54,7 @@ class MalwareDetailsFactoryImpl
|
||||
};
|
||||
|
||||
static base::LazyInstance<MalwareDetailsFactoryImpl>
|
||||
g_malware_details_factory_impl(base::LINKER_INITIALIZED);
|
||||
g_malware_details_factory_impl = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// Create a MalwareDetails for the given tab.
|
||||
/* static */
|
||||
|
@ -102,7 +102,7 @@ static const char* const kBoxChecked = "boxchecked";
|
||||
SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL;
|
||||
|
||||
static base::LazyInstance<SafeBrowsingBlockingPage::UnsafeResourceMap>
|
||||
g_unsafe_resource_map(base::LINKER_INITIALIZED);
|
||||
g_unsafe_resource_map = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we
|
||||
// don't leak it.
|
||||
@ -127,7 +127,7 @@ class SafeBrowsingBlockingPageFactoryImpl
|
||||
};
|
||||
|
||||
static base::LazyInstance<SafeBrowsingBlockingPageFactoryImpl>
|
||||
g_safe_browsing_blocking_page_factory_impl(base::LINKER_INITIALIZED);
|
||||
g_safe_browsing_blocking_page_factory_impl = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
SafeBrowsingBlockingPage::SafeBrowsingBlockingPage(
|
||||
SafeBrowsingService* sb_service,
|
||||
|
@ -101,7 +101,7 @@ class SafeBrowsingServiceFactoryImpl : public SafeBrowsingServiceFactory {
|
||||
};
|
||||
|
||||
static base::LazyInstance<SafeBrowsingServiceFactoryImpl>
|
||||
g_safe_browsing_service_factory_impl(base::LINKER_INITIALIZED);
|
||||
g_safe_browsing_service_factory_impl = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
struct SafeBrowsingService::WhiteListedEntry {
|
||||
int render_process_host_id;
|
||||
|
@ -98,7 +98,8 @@ SpeechInputBubbleImages::SpeechInputBubbleImages() {
|
||||
}
|
||||
}
|
||||
|
||||
base::LazyInstance<SpeechInputBubbleImages> g_images(base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<SpeechInputBubbleImages> g_images =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -52,7 +52,7 @@ NotificationTrayImages::NotificationTrayImages() {
|
||||
IDR_SPEECH_INPUT_TRAY_BALLOON_ICON);
|
||||
}
|
||||
|
||||
base::LazyInstance<NotificationTrayImages> g_images(base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<NotificationTrayImages> g_images = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
using content::BrowserThread;
|
||||
|
||||
namespace {
|
||||
base::LazyInstance<SpellCheckProfile::CustomWordList> g_empty_list(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<SpellCheckProfile::CustomWordList> g_empty_list =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
} // namespace
|
||||
|
||||
SpellCheckProfile::SpellCheckProfile(const FilePath& profile_dir)
|
||||
|
@ -80,7 +80,7 @@ class DefaultSQLErrorHandlerFactory : public SQLErrorHandlerFactory {
|
||||
};
|
||||
|
||||
static base::LazyInstance<DefaultSQLErrorHandlerFactory>
|
||||
g_default_sql_error_handler_factory(base::LINKER_INITIALIZED);
|
||||
g_default_sql_error_handler_factory = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
SQLErrorHandlerFactory* GetErrorHandlerFactory() {
|
||||
// TODO(cpu): Testing needs to override the error handler.
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "chrome/browser/profiles/profile_dependency_manager.h"
|
||||
|
||||
namespace {
|
||||
base::LazyInstance<PinnedTabServiceFactory> g_pinned_tab_service_factory(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<PinnedTabServiceFactory> g_pinned_tab_service_factory =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -141,7 +141,7 @@ const char* const TranslateManager::kTargetLanguagesKey = "tl";
|
||||
|
||||
// static
|
||||
base::LazyInstance<std::set<std::string> >
|
||||
TranslateManager::supported_languages_(base::LINKER_INITIALIZED);
|
||||
TranslateManager::supported_languages_ = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
TranslateManager::~TranslateManager() {
|
||||
weak_method_factory_.InvalidateWeakPtrs();
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2011 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.
|
||||
|
||||
@ -21,7 +21,7 @@ namespace {
|
||||
// rather than using a separated map.
|
||||
typedef std::map<NSView*, ViewID> ViewIDMap;
|
||||
|
||||
static base::LazyInstance<ViewIDMap> g_view_id_map(base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<ViewIDMap> g_view_id_map = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// Returns the view's nearest descendant (including itself) with a specific
|
||||
// ViewID, or nil if no subview has that ViewID.
|
||||
|
@ -51,7 +51,7 @@ const int kMillisecondsBeforeCollapsingFromTitleOnlyState = 0;
|
||||
|
||||
// static
|
||||
PanelManager* PanelManager::GetInstance() {
|
||||
static base::LazyInstance<PanelManager> instance(base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<PanelManager> instance = LAZY_INSTANCE_INITIALIZER;
|
||||
return instance.Pointer();
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
||||
namespace {
|
||||
|
||||
static base::LazyInstance<PropertyAccessor<TabContentsWrapper*> >
|
||||
g_tab_contents_wrapper_property_accessor(base::LINKER_INITIALIZED);
|
||||
g_tab_contents_wrapper_property_accessor = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// The list of prefs we want to observe.
|
||||
const char* kPrefsToObserve[] = {
|
||||
|
@ -416,7 +416,7 @@ void PaintPatcher::DerefPatch() {
|
||||
}
|
||||
}
|
||||
|
||||
base::LazyInstance<PaintPatcher> g_paint_patcher(base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<PaintPatcher> g_paint_patcher = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// twips are a unit of type measurement, and RichEdit controls use them
|
||||
// to set offsets.
|
||||
|
@ -86,7 +86,7 @@ class ChromeURLContentSecurityPolicyExceptionSet
|
||||
};
|
||||
|
||||
base::LazyInstance<ChromeURLContentSecurityPolicyExceptionSet>
|
||||
g_chrome_url_content_security_policy_exceptions(base::LINKER_INITIALIZED);
|
||||
g_chrome_url_content_security_policy_exceptions = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// Parse a URL into the components used to resolve its request. |source_name|
|
||||
// is the hostname and |path| is the remaining portion of the URL.
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "content/public/browser/notification_service.h"
|
||||
|
||||
static base::LazyInstance<PropertyAccessor<ConstrainedHtmlUIDelegate*> >
|
||||
g_constrained_html_ui_property_accessor(base::LINKER_INITIALIZED);
|
||||
g_constrained_html_ui_property_accessor = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
ConstrainedHtmlUI::ConstrainedHtmlUI(TabContents* contents)
|
||||
: ChromeWebUI(contents) {
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "content/public/common/bindings_policy.h"
|
||||
|
||||
static base::LazyInstance<PropertyAccessor<HtmlDialogUIDelegate*> >
|
||||
g_html_dialog_ui_property_accessor(base::LINKER_INITIALIZED);
|
||||
g_html_dialog_ui_property_accessor = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
HtmlDialogUI::HtmlDialogUI(TabContents* tab_contents)
|
||||
: ChromeWebUI(tab_contents) {
|
||||
|
@ -62,7 +62,7 @@ class PrintPreviewRequestIdMapWithLock {
|
||||
|
||||
// Written to on the UI thread, read from any thread.
|
||||
base::LazyInstance<PrintPreviewRequestIdMapWithLock>
|
||||
g_print_preview_request_id_map(base::LINKER_INITIALIZED);
|
||||
g_print_preview_request_id_map = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -31,8 +31,8 @@ namespace {
|
||||
const FilePath::CharType kMockJS[] = FILE_PATH_LITERAL("mock4js.js");
|
||||
const FilePath::CharType kWebUILibraryJS[] = FILE_PATH_LITERAL("test_api.js");
|
||||
const FilePath::CharType kWebUITestFolder[] = FILE_PATH_LITERAL("webui");
|
||||
base::LazyInstance<std::vector<std::string> > error_messages_(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<std::vector<std::string> > error_messages_ =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// Intercepts all log messages.
|
||||
bool LogHandler(int severity,
|
||||
@ -227,8 +227,8 @@ class MockWebUIProvider : public TestChromeWebUIFactory::WebUIProvider {
|
||||
}
|
||||
};
|
||||
|
||||
base::LazyInstance<MockWebUIProvider> mock_provider_(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<MockWebUIProvider> mock_provider_ =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -325,8 +325,8 @@ struct ExtensionToMessagesMap {
|
||||
ExtensionToL10nMessagesMap messages_map;
|
||||
};
|
||||
|
||||
static base::LazyInstance<ExtensionToMessagesMap> g_extension_to_messages_map(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<ExtensionToMessagesMap> g_extension_to_messages_map =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
ExtensionToMessagesMap::ExtensionToMessagesMap() {}
|
||||
|
||||
|
@ -91,7 +91,7 @@ class ProfilingThreadControl {
|
||||
|
||||
base::LazyInstance<ProfilingThreadControl,
|
||||
base::LeakyLazyInstanceTraits<ProfilingThreadControl> >
|
||||
g_flush_thread_control(base::LINKER_INITIALIZED);
|
||||
g_flush_thread_control = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -181,8 +181,8 @@ class TimeFormatter {
|
||||
DISALLOW_COPY_AND_ASSIGN(TimeFormatter);
|
||||
};
|
||||
|
||||
static base::LazyInstance<TimeFormatter> g_time_formatter(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<TimeFormatter> g_time_formatter =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
void TimeFormatter::BuildFormats(
|
||||
FormatType format_type, std::vector<icu::PluralFormat*>* time_formats) {
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
|
||||
typedef base::hash_map<const std::wstring, PluginInstallDialog*> DialogMap;
|
||||
base::LazyInstance<DialogMap> s_dialogs(base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<DialogMap> s_dialogs = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
PluginInstallDialog* PluginInstallDialog::AddInstaller(
|
||||
PluginInstallerImpl* plugin_impl, const std::wstring& plugin_name) {
|
||||
|
@ -20,8 +20,8 @@ namespace {
|
||||
const char kDistroDict[] = "distribution";
|
||||
const char kFirstRunTabs[] = "first_run_tabs";
|
||||
|
||||
base::LazyInstance<installer::MasterPreferences> g_master_preferences(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<installer::MasterPreferences> g_master_preferences =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
bool GetGURLFromValue(const Value* in_value, GURL* out_value) {
|
||||
if (!in_value || !out_value)
|
||||
|
@ -32,10 +32,10 @@ const char kValidateCallbacks[] = "validateCallbacks";
|
||||
#endif
|
||||
|
||||
typedef std::map<int, std::string> StringMap;
|
||||
static base::LazyInstance<StringMap> g_string_map(base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<StringMap> g_string_map = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
static base::LazyInstance<ChromeV8Extension::InstanceSet> g_instances(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<ChromeV8Extension::InstanceSet> g_instances =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -50,10 +50,10 @@ const char kInvalidWebstoreItemUrlError[] =
|
||||
// (successful or not) via HandleInstallResponse.
|
||||
int g_next_install_id = 0;
|
||||
|
||||
base::LazyInstance<WeakV8FunctionMap> g_success_callbacks(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<WeakV8FunctionMap> g_failure_callbacks(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<WeakV8FunctionMap> g_success_callbacks =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
base::LazyInstance<WeakV8FunctionMap> g_failure_callbacks =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
@ -46,8 +46,8 @@ struct SingletonData {
|
||||
std::map<std::string, EventListenerCounts> listener_counts_;
|
||||
};
|
||||
|
||||
static base::LazyInstance<SingletonData> g_singleton_data(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<SingletonData> g_singleton_data =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
static EventListenerCounts& GetListenerCounts(const std::string& extension_id) {
|
||||
return g_singleton_data.Get().listener_counts_[extension_id];
|
||||
|
@ -47,7 +47,8 @@ namespace {
|
||||
// document to another with adoptNode, and so having the object be a
|
||||
// RenderViewObserver means it might miss some notifications after it moves.
|
||||
typedef std::map<WebFrame*, UserScriptIdleScheduler*> SchedulerMap;
|
||||
static base::LazyInstance<SchedulerMap> g_schedulers(base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<SchedulerMap> g_schedulers =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
}
|
||||
|
||||
ExtensionHelper::ExtensionHelper(content::RenderView* render_view,
|
||||
|
@ -45,8 +45,8 @@ struct ExtensionData {
|
||||
std::map<int, PortData> ports; // port ID -> data
|
||||
};
|
||||
|
||||
static base::LazyInstance<ExtensionData> g_extension_data(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<ExtensionData> g_extension_data =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
static bool HasPortData(int port_id) {
|
||||
return g_extension_data.Get().ports.find(port_id) !=
|
||||
|
@ -79,8 +79,8 @@ struct PendingRequest {
|
||||
};
|
||||
typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap;
|
||||
|
||||
base::LazyInstance<PendingRequestMap> g_pending_requests(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<PendingRequestMap> g_pending_requests =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// A RenderViewVisitor class that iterates through the set of available
|
||||
// views, looking for a view of the given type, in the given browser window
|
||||
|
@ -37,10 +37,10 @@ static GURL StripRef(const GURL& url) {
|
||||
|
||||
typedef std::set<PhishingClassifierDelegate*> PhishingClassifierDelegates;
|
||||
static base::LazyInstance<PhishingClassifierDelegates>
|
||||
g_delegates(base::LINKER_INITIALIZED);
|
||||
g_delegates = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
static base::LazyInstance<scoped_ptr<const safe_browsing::Scorer> >
|
||||
g_phishing_scorer(base::LINKER_INITIALIZED);
|
||||
g_phishing_scorer = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// static
|
||||
PhishingClassifierFilter* PhishingClassifierFilter::Create() {
|
||||
|
@ -10,7 +10,7 @@
|
||||
// Keep the global CloudPrintTokenStore in a TLS slot so it is impossible to
|
||||
// incorrectly from the wrong thread.
|
||||
static base::LazyInstance<base::ThreadLocalPointer<CloudPrintTokenStore> >
|
||||
lazy_tls(base::LINKER_INITIALIZED);
|
||||
lazy_tls = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
CloudPrintTokenStore* CloudPrintTokenStore::current() {
|
||||
return lazy_tls.Pointer()->Get();
|
||||
|
@ -505,7 +505,7 @@ bool ProxyFactory::ReleaseAutomationServer(void* server_id,
|
||||
|
||||
static base::LazyInstance<ProxyFactory,
|
||||
base::LeakyLazyInstanceTraits<ProxyFactory> >
|
||||
g_proxy_factory(base::LINKER_INITIALIZED);
|
||||
g_proxy_factory = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
template <> struct RunnableMethodTraits<ChromeFrameAutomationClient> {
|
||||
static void RetainCallee(ChromeFrameAutomationClient* obj) {}
|
||||
|
@ -11,7 +11,7 @@ extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
namespace com_util {
|
||||
|
||||
base::LazyInstance<TypeInfoCache> type_info_cache(base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<TypeInfoCache> type_info_cache = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// TypeInfoCache
|
||||
|
||||
|
@ -12,7 +12,7 @@ static const wchar_t kChromeFrameMetricsKey[] =
|
||||
L"Software\\Google\\ChromeFrameMetrics";
|
||||
|
||||
base::LazyInstance<CrashMetricsReporter>
|
||||
g_crash_metrics_instance_(base::LINKER_INITIALIZED);
|
||||
g_crash_metrics_instance_ = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
wchar_t* CrashMetricsReporter::g_metric_names[LAST_METRIC] = {
|
||||
L"navigationcount",
|
||||
|
@ -15,8 +15,8 @@ DISABLE_RUNNABLE_METHOD_REFCOUNT(ExternalTabProxy);
|
||||
DISABLE_RUNNABLE_METHOD_REFCOUNT(UIDelegate);
|
||||
|
||||
namespace {
|
||||
static base::LazyInstance<ChromeProxyFactory> g_proxy_factory(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<ChromeProxyFactory> g_proxy_factory =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
struct UserDataHolder : public SyncMessageContext {
|
||||
explicit UserDataHolder(void* p) : data(p) {}
|
||||
|
@ -78,13 +78,13 @@ static const int kInitialUMAUploadTimeoutMilliSeconds = 30000;
|
||||
static const int kMinMilliSecondsPerUMAUpload = 600000;
|
||||
|
||||
base::LazyInstance<base::ThreadLocalPointer<MetricsService> >
|
||||
MetricsService::g_metrics_instance_(base::LINKER_INITIALIZED);
|
||||
MetricsService::g_metrics_instance_ = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
base::Lock MetricsService::metrics_service_lock_;
|
||||
|
||||
// Initialize histogram statistics gathering system.
|
||||
base::LazyInstance<base::StatisticsRecorder>
|
||||
g_statistics_recorder_(base::LINKER_INITIALIZED);
|
||||
g_statistics_recorder_ = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// This class provides functionality to upload the ChromeFrame UMA data to the
|
||||
// server. An instance of this class is created whenever we have data to be
|
||||
|
@ -136,15 +136,15 @@ class FakeBrowserProcessImpl : public BrowserProcessImpl {
|
||||
};
|
||||
|
||||
base::LazyInstance<chrome::ChromeContentClient>
|
||||
g_chrome_content_client(base::LINKER_INITIALIZED);
|
||||
g_chrome_content_client = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// Override the default ContentBrowserClient to let Chrome participate in
|
||||
// content logic. Must be done before any tabs are created.
|
||||
base::LazyInstance<chrome::ChromeContentBrowserClient>
|
||||
g_browser_client(base::LINKER_INITIALIZED);
|
||||
g_browser_client = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
base::LazyInstance<chrome::ChromeContentRendererClient>
|
||||
g_renderer_client(base::LINKER_INITIALIZED);
|
||||
g_renderer_client = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -23,7 +23,7 @@ static const int kMonikerBindToObject = 8;
|
||||
static const int kMonikerBindToStorage = kMonikerBindToObject + 1;
|
||||
|
||||
base::LazyInstance<base::ThreadLocalPointer<NavigationManager> >
|
||||
NavigationManager::thread_singleton_(base::LINKER_INITIALIZED);
|
||||
NavigationManager::thread_singleton_ = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
BEGIN_VTABLE_PATCHES(IMoniker)
|
||||
VTABLE_PATCH_ENTRY(kMonikerBindToObject, MonikerPatch::BindToObject)
|
||||
|
@ -110,7 +110,7 @@ namespace {
|
||||
// pointer so it should not be dereferenced and used for comparison against a
|
||||
// living instance only.
|
||||
base::LazyInstance<base::ThreadLocalPointer<IBrowserService> >
|
||||
g_tls_browser_for_cf_navigation(base::LINKER_INITIALIZED);
|
||||
g_tls_browser_for_cf_navigation = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
|
@ -35,8 +35,8 @@ using content::BrowserThread;
|
||||
namespace {
|
||||
|
||||
typedef std::list<BrowserChildProcessHost*> ChildProcessList;
|
||||
static base::LazyInstance<ChildProcessList> g_child_process_list(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<ChildProcessList> g_child_process_list =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// The NotificationTask is used to notify about plugin process connection/
|
||||
// disconnection. It is needed because the notifications in the
|
||||
|
@ -36,7 +36,7 @@ namespace {
|
||||
// without holding this lock. Do not block while holding this lock.
|
||||
base::LazyInstance<base::Lock,
|
||||
base::LeakyLazyInstanceTraits<base::Lock> >
|
||||
g_lock(base::LINKER_INITIALIZED);
|
||||
g_lock = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
|
||||
// An array of the BrowserThread objects. This array is protected by |g_lock|.
|
||||
|
@ -17,7 +17,8 @@
|
||||
base::LazyInstance<
|
||||
BrowsingInstance::ContextSiteInstanceMap,
|
||||
base::LeakyLazyInstanceTraits<BrowsingInstance::ContextSiteInstanceMap> >
|
||||
BrowsingInstance::context_site_instance_map_(base::LINKER_INITIALIZED);
|
||||
BrowsingInstance::context_site_instance_map_ =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
BrowsingInstance::BrowsingInstance(content::BrowserContext* browser_context)
|
||||
: browser_context_(browser_context) {
|
||||
|
@ -13,7 +13,7 @@ typedef std::vector<DevToolsClientHost*> DevToolsClientHostList;
|
||||
namespace {
|
||||
base::LazyInstance<DevToolsClientHostList,
|
||||
base::LeakyLazyInstanceTraits<DevToolsClientHostList> >
|
||||
g_instances(base::LINKER_INITIALIZED);
|
||||
g_instances = LAZY_INSTANCE_INITIALIZER;
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
|
@ -136,11 +136,11 @@ class TabContentsIDHelper : public TabContentsObserver {
|
||||
base::LazyInstance<
|
||||
TabContentsIDHelper::IdToTabContentsMap,
|
||||
base::LeakyLazyInstanceTraits<TabContentsIDHelper::IdToTabContentsMap> >
|
||||
TabContentsIDHelper::id_to_tabcontents_(base::LINKER_INITIALIZED);
|
||||
TabContentsIDHelper::id_to_tabcontents_ = LAZY_INSTANCE_INITIALIZER;
|
||||
base::LazyInstance<
|
||||
TabContentsIDHelper::TabContentsToIdMap,
|
||||
base::LeakyLazyInstanceTraits<TabContentsIDHelper::TabContentsToIdMap> >
|
||||
TabContentsIDHelper::tabcontents_to_id_(base::LINKER_INITIALIZED);
|
||||
TabContentsIDHelper::tabcontents_to_id_ = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -22,7 +22,7 @@ typedef std::map<RenderViewHost*, RenderViewDevToolsAgentHost*> Instances;
|
||||
namespace {
|
||||
base::LazyInstance<Instances,
|
||||
base::LeakyLazyInstanceTraits<Instances> >
|
||||
g_instances(base::LINKER_INITIALIZED);
|
||||
g_instances = LAZY_INSTANCE_INITIALIZER;
|
||||
} // namespace
|
||||
|
||||
DevToolsAgentHost* RenderViewDevToolsAgentHost::FindFor(
|
||||
|
@ -49,8 +49,8 @@ enum GPUProcessLifetimeEvent {
|
||||
};
|
||||
|
||||
// A global map from GPU process host ID to GpuProcessHost.
|
||||
static base::LazyInstance<IDMap<GpuProcessHost> > g_hosts_by_id(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<IDMap<GpuProcessHost> > g_hosts_by_id =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// Number of times the gpu process has crashed in the current browser session.
|
||||
static int g_gpu_crash_count = 0;
|
||||
@ -593,7 +593,6 @@ bool GpuProcessHost::LaunchGpuProcess() {
|
||||
switches::kGpuStartupDialog,
|
||||
switches::kLoggingLevel,
|
||||
switches::kNoSandbox,
|
||||
switches::kTraceStartup,
|
||||
};
|
||||
cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
|
||||
arraysize(kSwitchNames));
|
||||
|
@ -35,8 +35,8 @@ namespace {
|
||||
#undef DestroyAll
|
||||
#endif
|
||||
|
||||
base::LazyInstance<IDMap<GpuProcessHostUIShim> > g_hosts_by_id(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<IDMap<GpuProcessHostUIShim> > g_hosts_by_id =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
class SendOnIOThreadTask : public Task {
|
||||
public:
|
||||
|
@ -108,8 +108,8 @@ class KeyUtilityClientImpl
|
||||
|
||||
// IndexedDBKeyUtilityClient definitions.
|
||||
|
||||
static base::LazyInstance<IndexedDBKeyUtilityClient> client_instance(
|
||||
base::LINKER_INITIALIZED);
|
||||
static base::LazyInstance<IndexedDBKeyUtilityClient> client_instance =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
IndexedDBKeyUtilityClient::IndexedDBKeyUtilityClient()
|
||||
: is_shutdown_(false) {
|
||||
|
@ -10,7 +10,7 @@
|
||||
namespace content {
|
||||
|
||||
static base::LazyInstance<MockResourceContext>
|
||||
g_mock_resource_context(base::LINKER_INITIALIZED);
|
||||
g_mock_resource_context = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
MockResourceContext* MockResourceContext::GetInstance() {
|
||||
return &g_mock_resource_context.Get();
|
||||
|
@ -32,7 +32,8 @@ const int URLRequestSlowDownloadJob::kSecondDownloadSize = 1024 * 10;
|
||||
base::LazyInstance<
|
||||
URLRequestSlowDownloadJob::SlowJobsSet,
|
||||
base::LeakyLazyInstanceTraits<URLRequestSlowDownloadJob::SlowJobsSet> >
|
||||
URLRequestSlowDownloadJob::pending_requests_(base::LINKER_INITIALIZED);
|
||||
URLRequestSlowDownloadJob::pending_requests_ =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
void URLRequestSlowDownloadJob::Start() {
|
||||
MessageLoop::current()->PostTask(
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2011 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.
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
#include "content/public/browser/notification_types.h"
|
||||
|
||||
static base::LazyInstance<base::ThreadLocalPointer<NotificationServiceImpl> >
|
||||
lazy_tls_ptr(base::LINKER_INITIALIZED);
|
||||
lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// static
|
||||
NotificationServiceImpl* NotificationServiceImpl::current() {
|
||||
|
@ -216,8 +216,8 @@ class ImageTransportClientGLX : public ImageTransportClient {
|
||||
static base::LazyInstance<GLXFBConfig> fbconfig_;
|
||||
};
|
||||
|
||||
base::LazyInstance<GLXFBConfig> ImageTransportClientGLX::fbconfig_(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<GLXFBConfig> ImageTransportClientGLX::fbconfig_ =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
class ImageTransportClientOSMesa : public ImageTransportClient {
|
||||
public:
|
||||
|
@ -19,8 +19,8 @@ struct WaitableEventLazyInstanceTraits
|
||||
return new (instance) WaitableEvent(false, false);
|
||||
}
|
||||
};
|
||||
base::LazyInstance<WaitableEvent, WaitableEventLazyInstanceTraits> dummy_event(
|
||||
base::LINKER_INITIALIZED);
|
||||
base::LazyInstance<WaitableEvent, WaitableEventLazyInstanceTraits> dummy_event =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
}
|
||||
|
||||
JavaBridgeChannelHost* JavaBridgeChannelHost::GetJavaBridgeChannelHost(
|
||||
|
@ -85,7 +85,7 @@ static bool IsSuitableHost(RenderProcessHost* host,
|
||||
// the global list of all renderer processes
|
||||
base::LazyInstance<IDMap<RenderProcessHost>,
|
||||
base::LeakyLazyInstanceTraits<IDMap<RenderProcessHost> > >
|
||||
g_all_hosts(base::LINKER_INITIALIZED);
|
||||
g_all_hosts = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -49,7 +49,7 @@ class SpeechInputDispatcherHost::SpeechInputCallers {
|
||||
};
|
||||
|
||||
static base::LazyInstance<SpeechInputDispatcherHost::SpeechInputCallers>
|
||||
g_speech_input_callers(base::LINKER_INITIALIZED);
|
||||
g_speech_input_callers = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
SpeechInputDispatcherHost::SpeechInputCallers::SpeechInputCallers()
|
||||
: next_id_(1) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user