OLD | NEW |
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 Loading... |
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 |
OLD | NEW |