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 } | 20 } |
21 | 21 |
22 namespace ppapi { | 22 namespace ppapi { |
23 | 23 |
24 class CallbackTracker; | 24 class CallbackTracker; |
25 class FunctionGroupBase; | |
26 class ResourceTracker; | 25 class ResourceTracker; |
27 class VarTracker; | 26 class VarTracker; |
28 | 27 |
| 28 namespace thunk { |
| 29 class PPB_Instance_API; |
| 30 class ResourceCreationAPI; |
| 31 } |
| 32 |
29 // Abstract base class | 33 // Abstract base class |
30 class PPAPI_SHARED_EXPORT PpapiGlobals { | 34 class PPAPI_SHARED_EXPORT PpapiGlobals { |
31 public: | 35 public: |
32 PpapiGlobals(); | 36 PpapiGlobals(); |
33 | 37 |
34 // This constructor is to be used only for making a PpapiGlobal for testing | 38 // This constructor is to be used only for making a PpapiGlobal for testing |
35 // purposes. This avoids setting the global static ppapi_globals_. For unit | 39 // purposes. This avoids setting the global static ppapi_globals_. For unit |
36 // tests that use this feature, the "test" PpapiGlobals should be constructed | 40 // tests that use this feature, the "test" PpapiGlobals should be constructed |
37 // using this method. See SetPpapiGlobalsOnThreadForTest for more information. | 41 // using this method. See SetPpapiGlobalsOnThreadForTest for more information. |
38 struct ForTest {}; | 42 struct ForTest {}; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // log errors for things like bad resource IDs where we may not have an | 84 // log errors for things like bad resource IDs where we may not have an |
81 // associated instance. | 85 // associated instance. |
82 // | 86 // |
83 // Note that in the plugin process, the module parameter is ignored since | 87 // Note that in the plugin process, the module parameter is ignored since |
84 // there is only one possible one. | 88 // there is only one possible one. |
85 virtual void BroadcastLogWithSource(PP_Module module, | 89 virtual void BroadcastLogWithSource(PP_Module module, |
86 PP_LogLevel_Dev level, | 90 PP_LogLevel_Dev level, |
87 const std::string& source, | 91 const std::string& source, |
88 const std::string& value) = 0; | 92 const std::string& value) = 0; |
89 | 93 |
90 // Returns the function object corresponding to the given ID, or NULL if | 94 // Returns the given API object associated with the given instance, or NULL |
91 // there isn't one. | 95 // if the instance is invalid. |
92 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, ApiID id) = 0; | 96 virtual thunk::PPB_Instance_API* GetInstanceAPI(PP_Instance instance) = 0; |
| 97 virtual thunk::ResourceCreationAPI* GetResourceCreationAPI( |
| 98 PP_Instance instance) = 0; |
93 | 99 |
94 // Returns the PP_Module associated with the given PP_Instance, or 0 on | 100 // Returns the PP_Module associated with the given PP_Instance, or 0 on |
95 // failure. | 101 // failure. |
96 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0; | 102 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0; |
97 | 103 |
98 // Returns the command line for the process. | 104 // Returns the command line for the process. |
99 virtual std::string GetCommandLine() = 0; | 105 virtual std::string GetCommandLine() = 0; |
100 | 106 |
101 // Preloads the font on Windows, does nothing on other platforms. | 107 // Preloads the font on Windows, does nothing on other platforms. |
102 // TODO(brettw) remove this by passing the instance into the API so we don't | 108 // TODO(brettw) remove this by passing the instance into the API so we don't |
(...skipping 10 matching lines...) Expand all Loading... |
113 static PpapiGlobals* GetThreadLocalPointer(); | 119 static PpapiGlobals* GetThreadLocalPointer(); |
114 | 120 |
115 static PpapiGlobals* ppapi_globals_; | 121 static PpapiGlobals* ppapi_globals_; |
116 | 122 |
117 DISALLOW_COPY_AND_ASSIGN(PpapiGlobals); | 123 DISALLOW_COPY_AND_ASSIGN(PpapiGlobals); |
118 }; | 124 }; |
119 | 125 |
120 } // namespace ppapi | 126 } // namespace ppapi |
121 | 127 |
122 #endif // PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ | 128 #endif // PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ |
OLD | NEW |