Chromium Code Reviews| 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/memory/ref_counted.h" | |
| 11 #include "base/threading/thread_local.h" // For testing purposes only. | 12 #include "base/threading/thread_local.h" // For testing purposes only. |
| 12 #include "ppapi/c/dev/ppb_console_dev.h" | 13 #include "ppapi/c/dev/ppb_console_dev.h" |
| 13 #include "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
| 14 #include "ppapi/c/pp_module.h" | 15 #include "ppapi/c/pp_module.h" |
| 15 #include "ppapi/shared_impl/api_id.h" | 16 #include "ppapi/shared_impl/api_id.h" |
| 16 #include "ppapi/shared_impl/ppapi_shared_export.h" | 17 #include "ppapi/shared_impl/ppapi_shared_export.h" |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 class Lock; | 20 class Lock; |
| 20 class MessageLoopProxy; | 21 class MessageLoopProxy; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 virtual thunk::ResourceCreationAPI* GetResourceCreationAPI( | 99 virtual thunk::ResourceCreationAPI* GetResourceCreationAPI( |
| 99 PP_Instance instance) = 0; | 100 PP_Instance instance) = 0; |
| 100 | 101 |
| 101 // Returns the PP_Module associated with the given PP_Instance, or 0 on | 102 // Returns the PP_Module associated with the given PP_Instance, or 0 on |
| 102 // failure. | 103 // failure. |
| 103 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0; | 104 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0; |
| 104 | 105 |
| 105 // Returns the base::MessageLoopProxy for the main thread. Note that this must | 106 // Returns the base::MessageLoopProxy for the main thread. Note that this must |
| 106 // be called on the main thread the first time so that it can initialize | 107 // be called on the main thread the first time so that it can initialize |
| 107 // its static data. | 108 // its static data. |
| 108 base::MessageLoopProxy* GetMainThreadMessageLoop(); | 109 // Virtual for testing. |
|
brettw
2012/07/13 16:36:22
I think you can revert this part.
| |
| 110 virtual base::MessageLoopProxy* GetMainThreadMessageLoop(); | |
| 109 | 111 |
| 110 // Returns the command line for the process. | 112 // Returns the command line for the process. |
| 111 virtual std::string GetCmdLine() = 0; | 113 virtual std::string GetCmdLine() = 0; |
| 112 | 114 |
| 113 // Preloads the font on Windows, does nothing on other platforms. | 115 // Preloads the font on Windows, does nothing on other platforms. |
| 114 // TODO(brettw) remove this by passing the instance into the API so we don't | 116 // TODO(brettw) remove this by passing the instance into the API so we don't |
| 115 // have to have it on the globals. | 117 // have to have it on the globals. |
| 116 virtual void PreCacheFontForFlash(const void* logfontw) = 0; | 118 virtual void PreCacheFontForFlash(const void* logfontw) = 0; |
| 117 | 119 |
| 118 virtual bool IsHostGlobals() const; | 120 virtual bool IsHostGlobals() const; |
| 119 virtual bool IsPluginGlobals() const; | 121 virtual bool IsPluginGlobals() const; |
| 120 | 122 |
| 121 private: | 123 private: |
| 122 // Return the thread-local pointer which is used only for unit testing. It | 124 // Return the thread-local pointer which is used only for unit testing. It |
| 123 // should always be NULL when running in production. It allows separate | 125 // should always be NULL when running in production. It allows separate |
| 124 // threads to have distinct "globals". | 126 // threads to have distinct "globals". |
| 125 static PpapiGlobals* GetThreadLocalPointer(); | 127 static PpapiGlobals* GetThreadLocalPointer(); |
| 126 | 128 |
| 127 static PpapiGlobals* ppapi_globals_; | 129 static PpapiGlobals* ppapi_globals_; |
| 128 | 130 |
| 131 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | |
| 132 | |
| 129 DISALLOW_COPY_AND_ASSIGN(PpapiGlobals); | 133 DISALLOW_COPY_AND_ASSIGN(PpapiGlobals); |
| 130 }; | 134 }; |
| 131 | 135 |
| 132 } // namespace ppapi | 136 } // namespace ppapi |
| 133 | 137 |
| 134 #endif // PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ | 138 #endif // PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ |
| OLD | NEW |