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

Side by Side Diff: ppapi/shared_impl/ppapi_globals.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « ppapi/proxy/interface_list.cc ('k') | printing/print_settings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/shared_impl/ppapi_globals.h" 5 #include "ppapi/shared_impl/ppapi_globals.h"
6 6
7 #include "base/lazy_instance.h" // For testing purposes only. 7 #include "base/lazy_instance.h" // For testing purposes only.
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_local.h" // For testing purposes only. 10 #include "base/threading/thread_local.h" // For testing purposes only.
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 12
13 namespace ppapi { 13 namespace ppapi {
14 14
15 namespace { 15 namespace {
16 // Thread-local globals for testing. See SetPpapiGlobalsOnThreadForTest for more 16 // Thread-local globals for testing. See SetPpapiGlobalsOnThreadForTest for more
17 // information. 17 // information.
18 base::LazyInstance<base::ThreadLocalPointer<PpapiGlobals> >::Leaky 18 base::LazyInstance<base::ThreadLocalPointer<PpapiGlobals>>::Leaky
19 tls_ppapi_globals_for_test = LAZY_INSTANCE_INITIALIZER; 19 tls_ppapi_globals_for_test = LAZY_INSTANCE_INITIALIZER;
20 } // namespace 20 } // namespace
21 21
22 PpapiGlobals* ppapi_globals = NULL; 22 PpapiGlobals* ppapi_globals = NULL;
23 23
24 PpapiGlobals::PpapiGlobals() { 24 PpapiGlobals::PpapiGlobals() {
25 DCHECK(!ppapi_globals); 25 DCHECK(!ppapi_globals);
26 ppapi_globals = this; 26 ppapi_globals = this;
27 main_task_runner_ = base::ThreadTaskRunnerHandle::Get(); 27 main_task_runner_ = base::ThreadTaskRunnerHandle::Get();
28 } 28 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 bool PpapiGlobals::IsPluginGlobals() const { return false; } 67 bool PpapiGlobals::IsPluginGlobals() const { return false; }
68 68
69 void PpapiGlobals::MarkPluginIsActive() {} 69 void PpapiGlobals::MarkPluginIsActive() {}
70 70
71 // static 71 // static
72 PpapiGlobals* PpapiGlobals::GetThreadLocalPointer() { 72 PpapiGlobals* PpapiGlobals::GetThreadLocalPointer() {
73 return tls_ppapi_globals_for_test.Pointer()->Get(); 73 return tls_ppapi_globals_for_test.Pointer()->Get();
74 } 74 }
75 75
76 } // namespace ppapi 76 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/interface_list.cc ('k') | printing/print_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698