Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: ppapi/proxy/host_dispatcher.h

Issue 7655002: Convert the pp::proxy namespace to the ppapi::proxy namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/shared_impl/function_group_base.h" 16 #include "ppapi/shared_impl/function_group_base.h"
17 17
18 struct PPB_Proxy_Private; 18 struct PPB_Proxy_Private;
19 struct PPB_Var_Deprecated; 19 struct PPB_Var_Deprecated;
20 20
21 namespace base { 21 namespace base {
22 class WaitableEvent; 22 class WaitableEvent;
23 } 23 }
24 24
25 namespace IPC { 25 namespace IPC {
26 class SyncChannel; 26 class SyncChannel;
27 } 27 }
28 28
29 namespace ppapi { 29 namespace ppapi {
30
30 struct Preferences; 31 struct Preferences;
31 }
32 32
33 namespace pp {
34 namespace proxy { 33 namespace proxy {
35 34
36 class InterfaceProxy; 35 class InterfaceProxy;
37 class VarSerialization; 36 class VarSerialization;
38 37
39 class HostDispatcher : public Dispatcher { 38 class HostDispatcher : public Dispatcher {
40 public: 39 public:
41 // Constructor for the renderer side. 40 // Constructor for the renderer side.
42 // 41 //
43 // You must call InitHostWithChannel after the constructor. 42 // You must call InitHostWithChannel after the constructor.
44 HostDispatcher(base::ProcessHandle host_process_handle, 43 HostDispatcher(base::ProcessHandle host_process_handle,
45 PP_Module module, 44 PP_Module module,
46 GetInterfaceFunc local_get_interface); 45 GetInterfaceFunc local_get_interface);
47 ~HostDispatcher(); 46 ~HostDispatcher();
48 47
49 // You must call this function before anything else. Returns true on success. 48 // You must call this function before anything else. Returns true on success.
50 // The delegate pointer must outlive this class, ownership is not 49 // The delegate pointer must outlive this class, ownership is not
51 // transferred. 50 // transferred.
52 virtual bool InitHostWithChannel(Delegate* delegate, 51 virtual bool InitHostWithChannel(Delegate* delegate,
53 const IPC::ChannelHandle& channel_handle, 52 const IPC::ChannelHandle& channel_handle,
54 bool is_client, 53 bool is_client,
55 const ppapi::Preferences& preferences); 54 const Preferences& preferences);
56 55
57 // The host side maintains a mapping from PP_Instance to Dispatcher so 56 // The host side maintains a mapping from PP_Instance to Dispatcher so
58 // that we can send the messages to the right channel. 57 // that we can send the messages to the right channel.
59 static HostDispatcher* GetForInstance(PP_Instance instance); 58 static HostDispatcher* GetForInstance(PP_Instance instance);
60 static void SetForInstance(PP_Instance instance, 59 static void SetForInstance(PP_Instance instance,
61 HostDispatcher* dispatcher); 60 HostDispatcher* dispatcher);
62 static void RemoveForInstance(PP_Instance instance); 61 static void RemoveForInstance(PP_Instance instance);
63 62
64 // Returns the host's notion of our PP_Module. This will be different than 63 // Returns the host's notion of our PP_Module. This will be different than
65 // the plugin's notion of its PP_Module because the plugin process may be 64 // the plugin's notion of its PP_Module because the plugin process may be
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // name is not in the map, that implies that we haven't queried for it yet. 113 // name is not in the map, that implies that we haven't queried for it yet.
115 std::map<std::string, bool> plugin_if_supported_; 114 std::map<std::string, bool> plugin_if_supported_;
116 115
117 // All target proxies currently created. These are ones that receive 116 // All target proxies currently created. These are ones that receive
118 // messages. They are created on demand when we receive messages. 117 // messages. They are created on demand when we receive messages.
119 scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT]; 118 scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT];
120 119
121 // Function proxies created for "new-style" FunctionGroups. 120 // Function proxies created for "new-style" FunctionGroups.
122 // TODO(brettw) this is in progress. It should be merged with the target 121 // TODO(brettw) this is in progress. It should be merged with the target
123 // proxies so there is one list to consult. 122 // proxies so there is one list to consult.
124 scoped_ptr< ::ppapi::FunctionGroupBase > 123 scoped_ptr<FunctionGroupBase >
125 function_proxies_[INTERFACE_ID_COUNT]; 124 function_proxies_[INTERFACE_ID_COUNT];
126 125
127 // Guaranteed non-NULL. 126 // Guaranteed non-NULL.
128 const PPB_Proxy_Private* ppb_proxy_; 127 const PPB_Proxy_Private* ppb_proxy_;
129 128
130 // Set to true when the plugin is in a state that it can be reentered by a 129 // Set to true when the plugin is in a state that it can be reentered by a
131 // sync message from the host. We allow reentrancy only when we're processing 130 // sync message from the host. We allow reentrancy only when we're processing
132 // a sync message from the renderer that is a scripting command. When the 131 // a sync message from the renderer that is a scripting command. When the
133 // plugin is in this state, it needs to accept reentrancy since scripting may 132 // plugin is in this state, it needs to accept reentrancy since scripting may
134 // ultimately call back into the plugin. 133 // ultimately call back into the plugin.
(...skipping 13 matching lines...) Expand all
148 ScopedModuleReference(Dispatcher* dispatcher); 147 ScopedModuleReference(Dispatcher* dispatcher);
149 ~ScopedModuleReference(); 148 ~ScopedModuleReference();
150 149
151 private: 150 private:
152 HostDispatcher* dispatcher_; 151 HostDispatcher* dispatcher_;
153 152
154 DISALLOW_COPY_AND_ASSIGN(ScopedModuleReference); 153 DISALLOW_COPY_AND_ASSIGN(ScopedModuleReference);
155 }; 154 };
156 155
157 } // namespace proxy 156 } // namespace proxy
158 } // namespace pp 157 } // namespace ppapi
159 158
160 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_ 159 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698