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 #ifndef PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ |
6 #define PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ | 6 #define PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/threading/thread_local.h" // For testing purposes only. | 11 #include "base/threading/thread_local.h" // For testing purposes only. |
12 #include "ppapi/c/dev/ppb_console_dev.h" | 12 #include "ppapi/c/dev/ppb_console_dev.h" |
13 #include "ppapi/c/pp_instance.h" | 13 #include "ppapi/c/pp_instance.h" |
14 #include "ppapi/c/pp_module.h" | 14 #include "ppapi/c/pp_module.h" |
15 #include "ppapi/shared_impl/api_id.h" | 15 #include "ppapi/shared_impl/api_id.h" |
16 #include "ppapi/shared_impl/ppapi_shared_export.h" | 16 #include "ppapi/shared_impl/ppapi_shared_export.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class Lock; | 19 class Lock; |
| 20 class MessageLoopProxy; |
20 } | 21 } |
21 | 22 |
22 namespace ppapi { | 23 namespace ppapi { |
23 | 24 |
24 class CallbackTracker; | 25 class CallbackTracker; |
25 class FunctionGroupBase; | 26 class FunctionGroupBase; |
26 class ResourceTracker; | 27 class ResourceTracker; |
27 class VarTracker; | 28 class VarTracker; |
28 | 29 |
29 // Abstract base class | 30 // Abstract base class |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 const std::string& value) = 0; | 89 const std::string& value) = 0; |
89 | 90 |
90 // Returns the function object corresponding to the given ID, or NULL if | 91 // Returns the function object corresponding to the given ID, or NULL if |
91 // there isn't one. | 92 // there isn't one. |
92 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, ApiID id) = 0; | 93 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, ApiID id) = 0; |
93 | 94 |
94 // Returns the PP_Module associated with the given PP_Instance, or 0 on | 95 // Returns the PP_Module associated with the given PP_Instance, or 0 on |
95 // failure. | 96 // failure. |
96 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0; | 97 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0; |
97 | 98 |
| 99 base::MessageLoopProxy* GetMainThreadMessageLoop(); |
| 100 |
98 virtual bool IsHostGlobals() const; | 101 virtual bool IsHostGlobals() const; |
99 virtual bool IsPluginGlobals() const; | 102 virtual bool IsPluginGlobals() const; |
100 | 103 |
101 private: | 104 private: |
102 // Return the thread-local pointer which is used only for unit testing. It | 105 // Return the thread-local pointer which is used only for unit testing. It |
103 // should always be NULL when running in production. It allows separate | 106 // should always be NULL when running in production. It allows separate |
104 // threads to have distinct "globals". | 107 // threads to have distinct "globals". |
105 static PpapiGlobals* GetThreadLocalPointer(); | 108 static PpapiGlobals* GetThreadLocalPointer(); |
106 | 109 |
107 static PpapiGlobals* ppapi_globals_; | 110 static PpapiGlobals* ppapi_globals_; |
108 | 111 |
109 DISALLOW_COPY_AND_ASSIGN(PpapiGlobals); | 112 DISALLOW_COPY_AND_ASSIGN(PpapiGlobals); |
110 }; | 113 }; |
111 | 114 |
112 } // namespace ppapi | 115 } // namespace ppapi |
113 | 116 |
114 #endif // PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ | 117 #endif // PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ |
OLD | NEW |