| 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 ResourceTracker; | 26 class ResourceTracker; |
| 26 class VarTracker; | 27 class VarTracker; |
| 27 | 28 |
| 28 namespace thunk { | 29 namespace thunk { |
| 29 class PPB_Instance_API; | 30 class PPB_Instance_API; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // Returns the given API object associated with the given instance, or NULL | 95 // Returns the given API object associated with the given instance, or NULL |
| 95 // if the instance is invalid. | 96 // if the instance is invalid. |
| 96 virtual thunk::PPB_Instance_API* GetInstanceAPI(PP_Instance instance) = 0; | 97 virtual thunk::PPB_Instance_API* GetInstanceAPI(PP_Instance instance) = 0; |
| 97 virtual thunk::ResourceCreationAPI* GetResourceCreationAPI( | 98 virtual thunk::ResourceCreationAPI* GetResourceCreationAPI( |
| 98 PP_Instance instance) = 0; | 99 PP_Instance instance) = 0; |
| 99 | 100 |
| 100 // Returns the PP_Module associated with the given PP_Instance, or 0 on | 101 // Returns the PP_Module associated with the given PP_Instance, or 0 on |
| 101 // failure. | 102 // failure. |
| 102 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0; | 103 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0; |
| 103 | 104 |
| 105 // 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 // its static data. |
| 108 base::MessageLoopProxy* GetMainThreadMessageLoop(); |
| 109 |
| 104 // Returns the command line for the process. | 110 // Returns the command line for the process. |
| 105 virtual std::string GetCmdLine() = 0; | 111 virtual std::string GetCmdLine() = 0; |
| 106 | 112 |
| 107 // Preloads the font on Windows, does nothing on other platforms. | 113 // Preloads the font on Windows, does nothing on other platforms. |
| 108 // TODO(brettw) remove this by passing the instance into the API so we don't | 114 // TODO(brettw) remove this by passing the instance into the API so we don't |
| 109 // have to have it on the globals. | 115 // have to have it on the globals. |
| 110 virtual void PreCacheFontForFlash(const void* logfontw) = 0; | 116 virtual void PreCacheFontForFlash(const void* logfontw) = 0; |
| 111 | 117 |
| 112 virtual bool IsHostGlobals() const; | 118 virtual bool IsHostGlobals() const; |
| 113 virtual bool IsPluginGlobals() const; | 119 virtual bool IsPluginGlobals() const; |
| 114 | 120 |
| 115 private: | 121 private: |
| 116 // Return the thread-local pointer which is used only for unit testing. It | 122 // Return the thread-local pointer which is used only for unit testing. It |
| 117 // should always be NULL when running in production. It allows separate | 123 // should always be NULL when running in production. It allows separate |
| 118 // threads to have distinct "globals". | 124 // threads to have distinct "globals". |
| 119 static PpapiGlobals* GetThreadLocalPointer(); | 125 static PpapiGlobals* GetThreadLocalPointer(); |
| 120 | 126 |
| 121 static PpapiGlobals* ppapi_globals_; | 127 static PpapiGlobals* ppapi_globals_; |
| 122 | 128 |
| 123 DISALLOW_COPY_AND_ASSIGN(PpapiGlobals); | 129 DISALLOW_COPY_AND_ASSIGN(PpapiGlobals); |
| 124 }; | 130 }; |
| 125 | 131 |
| 126 } // namespace ppapi | 132 } // namespace ppapi |
| 127 | 133 |
| 128 #endif // PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ | 134 #endif // PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ |
| OLD | NEW |