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_HOST_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_HOST_DISPATCHER_H_ |
6 #define PPAPI_PROXY_HOST_DISPATCHER_H_ | 6 #define PPAPI_PROXY_HOST_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
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 "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
15 #include "ppapi/proxy/dispatcher.h" | 15 #include "ppapi/proxy/dispatcher.h" |
16 #include "ppapi/proxy/plugin_var_tracker.h" | 16 #include "ppapi/proxy/plugin_var_tracker.h" |
17 #include "ppapi/shared_impl/function_group_base.h" | 17 #include "ppapi/shared_impl/function_group_base.h" |
18 | 18 |
19 struct PPB_Proxy_Private; | 19 struct PPB_Proxy_Private; |
20 struct PPB_Var_Deprecated; | 20 struct PPB_Var_Deprecated; |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class WaitableEvent; | 23 class WaitableEvent; |
24 } | 24 } |
25 | 25 |
26 namespace IPC { | 26 namespace IPC { |
27 class SyncChannel; | 27 class SyncChannel; |
28 } | 28 } |
29 | 29 |
| 30 namespace ppapi { |
| 31 struct Preferences; |
| 32 } |
| 33 |
30 namespace pp { | 34 namespace pp { |
31 namespace proxy { | 35 namespace proxy { |
32 | 36 |
33 class InterfaceProxy; | 37 class InterfaceProxy; |
34 class VarSerialization; | 38 class VarSerialization; |
35 | 39 |
36 class HostDispatcher : public Dispatcher { | 40 class HostDispatcher : public Dispatcher { |
37 public: | 41 public: |
38 // Constructor for the renderer side. | 42 // Constructor for the renderer side. |
39 // | 43 // |
40 // You must call InitHostWithChannel after the constructor. | 44 // You must call InitHostWithChannel after the constructor. |
41 HostDispatcher(base::ProcessHandle host_process_handle, | 45 HostDispatcher(base::ProcessHandle host_process_handle, |
42 PP_Module module, | 46 PP_Module module, |
43 GetInterfaceFunc local_get_interface); | 47 GetInterfaceFunc local_get_interface); |
44 ~HostDispatcher(); | 48 ~HostDispatcher(); |
45 | 49 |
46 // You must call this function before anything else. Returns true on success. | 50 // You must call this function before anything else. Returns true on success. |
47 // The delegate pointer must outlive this class, ownership is not | 51 // The delegate pointer must outlive this class, ownership is not |
48 // transferred. | 52 // transferred. |
49 virtual bool InitHostWithChannel(Delegate* delegate, | 53 virtual bool InitHostWithChannel(Delegate* delegate, |
50 const IPC::ChannelHandle& channel_handle, | 54 const IPC::ChannelHandle& channel_handle, |
51 bool is_client); | 55 bool is_client, |
| 56 const ppapi::Preferences& preferences); |
52 | 57 |
53 // The host side maintains a mapping from PP_Instance to Dispatcher so | 58 // The host side maintains a mapping from PP_Instance to Dispatcher so |
54 // that we can send the messages to the right channel. | 59 // that we can send the messages to the right channel. |
55 static HostDispatcher* GetForInstance(PP_Instance instance); | 60 static HostDispatcher* GetForInstance(PP_Instance instance); |
56 static void SetForInstance(PP_Instance instance, | 61 static void SetForInstance(PP_Instance instance, |
57 HostDispatcher* dispatcher); | 62 HostDispatcher* dispatcher); |
58 static void RemoveForInstance(PP_Instance instance); | 63 static void RemoveForInstance(PP_Instance instance); |
59 | 64 |
60 // Returns the host's notion of our PP_Module. This will be different than | 65 // Returns the host's notion of our PP_Module. This will be different than |
61 // the plugin's notion of its PP_Module because the plugin process may be | 66 // the plugin's notion of its PP_Module because the plugin process may be |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 private: | 154 private: |
150 HostDispatcher* dispatcher_; | 155 HostDispatcher* dispatcher_; |
151 | 156 |
152 DISALLOW_COPY_AND_ASSIGN(ScopedModuleReference); | 157 DISALLOW_COPY_AND_ASSIGN(ScopedModuleReference); |
153 }; | 158 }; |
154 | 159 |
155 } // namespace proxy | 160 } // namespace proxy |
156 } // namespace pp | 161 } // namespace pp |
157 | 162 |
158 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_ | 163 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_ |
OLD | NEW |