OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/process.h" | 13 #include "base/process.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "ppapi/c/pp_rect.h" | 15 #include "ppapi/c/pp_rect.h" |
16 #include "ppapi/c/pp_instance.h" | 16 #include "ppapi/c/pp_instance.h" |
17 #include "ppapi/proxy/dispatcher.h" | 17 #include "ppapi/proxy/dispatcher.h" |
18 #include "ppapi/shared_impl/function_group_base.h" | 18 #include "ppapi/shared_impl/function_group_base.h" |
19 #include "ppapi/shared_impl/ppapi_preferences.h" | 19 #include "ppapi/shared_impl/ppapi_preferences.h" |
20 | 20 |
21 class MessageLoop; | 21 class MessageLoop; |
22 | 22 |
23 namespace base { | 23 namespace base { |
24 class WaitableEvent; | 24 class WaitableEvent; |
25 } | 25 } |
26 | 26 |
27 namespace ppapi { | 27 namespace ppapi { |
28 struct Preferences; | 28 struct Preferences; |
| 29 class Resource; |
29 } | 30 } |
30 | 31 |
31 namespace pp { | 32 namespace pp { |
32 namespace proxy { | 33 namespace proxy { |
33 | 34 |
34 // Used to keep track of per-instance data. | 35 // Used to keep track of per-instance data. |
35 struct InstanceData { | 36 struct InstanceData { |
36 InstanceData() : fullscreen(PP_FALSE) {} | 37 InstanceData() : fullscreen(PP_FALSE) {} |
37 PP_Rect position; | 38 PP_Rect position; |
38 PP_Bool fullscreen; | 39 PP_Bool fullscreen; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 PluginDispatcher(base::ProcessHandle remote_process_handle, | 78 PluginDispatcher(base::ProcessHandle remote_process_handle, |
78 GetInterfaceFunc get_interface); | 79 GetInterfaceFunc get_interface); |
79 virtual ~PluginDispatcher(); | 80 virtual ~PluginDispatcher(); |
80 | 81 |
81 // The plugin side maintains a mapping from PP_Instance to Dispatcher so | 82 // The plugin side maintains a mapping from PP_Instance to Dispatcher so |
82 // that we can send the messages to the right channel if there are multiple | 83 // that we can send the messages to the right channel if there are multiple |
83 // renderers sharing the same plugin. This mapping is maintained by | 84 // renderers sharing the same plugin. This mapping is maintained by |
84 // DidCreateInstance/DidDestroyInstance. | 85 // DidCreateInstance/DidDestroyInstance. |
85 static PluginDispatcher* GetForInstance(PP_Instance instance); | 86 static PluginDispatcher* GetForInstance(PP_Instance instance); |
86 | 87 |
| 88 // Same as GetForInstance but retrieves the instance from the given resource |
| 89 // object as a convenience. Returns NULL on failure. |
| 90 static PluginDispatcher* GetForResource(const ppapi::Resource* resource); |
| 91 |
87 static const void* GetInterfaceFromDispatcher(const char* interface); | 92 static const void* GetInterfaceFromDispatcher(const char* interface); |
88 | 93 |
89 // You must call this function before anything else. Returns true on success. | 94 // You must call this function before anything else. Returns true on success. |
90 // The delegate pointer must outlive this class, ownership is not | 95 // The delegate pointer must outlive this class, ownership is not |
91 // transferred. | 96 // transferred. |
92 bool InitPluginWithChannel(PluginDelegate* delegate, | 97 bool InitPluginWithChannel(PluginDelegate* delegate, |
93 const IPC::ChannelHandle& channel_handle, | 98 const IPC::ChannelHandle& channel_handle, |
94 bool is_client); | 99 bool is_client); |
95 | 100 |
96 // Dispatcher overrides. | 101 // Dispatcher overrides. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 170 |
166 uint32 plugin_dispatcher_id_; | 171 uint32 plugin_dispatcher_id_; |
167 | 172 |
168 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); | 173 DISALLOW_COPY_AND_ASSIGN(PluginDispatcher); |
169 }; | 174 }; |
170 | 175 |
171 } // namespace proxy | 176 } // namespace proxy |
172 } // namespace pp | 177 } // namespace pp |
173 | 178 |
174 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ | 179 #endif // PPAPI_PROXY_PLUGIN_DISPATCHER_H_ |
OLD | NEW |