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_PROXY_PLUGIN_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 6 #define PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/hash_tables.h" | 12 #include "base/hash_tables.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/process.h" | 15 #include "base/process.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "ppapi/c/dev/ppb_console_dev.h" | 17 #include "ppapi/c/dev/ppb_console_dev.h" |
18 #include "ppapi/c/pp_rect.h" | 18 #include "ppapi/c/pp_rect.h" |
19 #include "ppapi/c/pp_instance.h" | 19 #include "ppapi/c/pp_instance.h" |
20 #include "ppapi/proxy/dispatcher.h" | 20 #include "ppapi/proxy/dispatcher.h" |
21 #include "ppapi/shared_impl/function_group_base.h" | |
22 #include "ppapi/shared_impl/ppapi_preferences.h" | 21 #include "ppapi/shared_impl/ppapi_preferences.h" |
23 #include "ppapi/shared_impl/ppb_view_shared.h" | 22 #include "ppapi/shared_impl/ppb_view_shared.h" |
24 | 23 |
25 namespace ppapi { | 24 namespace ppapi { |
26 | 25 |
27 struct Preferences; | 26 struct Preferences; |
28 class Resource; | 27 class Resource; |
29 | 28 |
| 29 namespace thunk { |
| 30 class PPB_Instance_API; |
| 31 class ResourceCreationAPI; |
| 32 } |
| 33 |
30 namespace proxy { | 34 namespace proxy { |
31 | 35 |
32 // Used to keep track of per-instance data. | 36 // Used to keep track of per-instance data. |
33 struct InstanceData { | 37 struct InstanceData { |
34 InstanceData(); | 38 InstanceData(); |
35 ~InstanceData(); | 39 ~InstanceData(); |
36 | 40 |
37 ViewData view; | 41 ViewData view; |
38 | 42 |
39 PP_Bool flash_fullscreen; // Used for PPB_FlashFullscreen. | 43 PP_Bool flash_fullscreen; // Used for PPB_FlashFullscreen. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 115 |
112 // Keeps track of which dispatcher to use for each instance, active instances | 116 // Keeps track of which dispatcher to use for each instance, active instances |
113 // and tracks associated data like the current size. | 117 // and tracks associated data like the current size. |
114 void DidCreateInstance(PP_Instance instance); | 118 void DidCreateInstance(PP_Instance instance); |
115 void DidDestroyInstance(PP_Instance instance); | 119 void DidDestroyInstance(PP_Instance instance); |
116 | 120 |
117 // Gets the data for an existing instance, or NULL if the instance id doesn't | 121 // Gets the data for an existing instance, or NULL if the instance id doesn't |
118 // correspond to a known instance. | 122 // correspond to a known instance. |
119 InstanceData* GetInstanceData(PP_Instance instance); | 123 InstanceData* GetInstanceData(PP_Instance instance); |
120 | 124 |
| 125 // Returns the corresponding API. These are APIs not associated with a |
| 126 // resource. Guaranteed non-NULL. |
| 127 thunk::PPB_Instance_API* GetInstanceAPI(); |
| 128 thunk::ResourceCreationAPI* GetResourceCreationAPI(); |
| 129 |
121 // Returns the Preferences. | 130 // Returns the Preferences. |
122 const Preferences& preferences() const { return preferences_; } | 131 const Preferences& preferences() const { return preferences_; } |
123 | 132 |
124 // Returns the "new-style" function API for the given interface ID, creating | |
125 // it if necessary. | |
126 // TODO(brettw) this is in progress. It should be merged with the target | |
127 // proxies so there is one list to consult. | |
128 FunctionGroupBase* GetFunctionAPI(ApiID id); | |
129 | |
130 uint32 plugin_dispatcher_id() const { return plugin_dispatcher_id_; } | 133 uint32 plugin_dispatcher_id() const { return plugin_dispatcher_id_; } |
131 | 134 |
132 private: | 135 private: |
133 friend class PluginDispatcherTest; | 136 friend class PluginDispatcherTest; |
134 | 137 |
135 // Notifies all live instances that they're now closed. This is used when | 138 // Notifies all live instances that they're now closed. This is used when |
136 // a renderer crashes or some other error is received. | 139 // a renderer crashes or some other error is received. |
137 void ForceFreeAllInstances(); | 140 void ForceFreeAllInstances(); |
138 | 141 |
139 // IPC message handlers. | 142 // IPC message handlers. |
(...skipping 19 matching lines...) Expand all Loading... |
159 | 162 |
160 uint32 plugin_dispatcher_id_; | 163 uint32 plugin_dispatcher_id_; |
161 | 164 |
162 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); | 165 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); |
163 }; | 166 }; |
164 | 167 |
165 } // namespace proxy | 168 } // namespace proxy |
166 } // namespace ppapi | 169 } // namespace ppapi |
167 | 170 |
168 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 171 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
OLD | NEW |