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

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

Issue 6905088: New thunk system for Pepper proxy and implementation (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 #include "ppapi/proxy/host_dispatcher.h" 5 #include "ppapi/proxy/host_dispatcher.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "gpu/common/gpu_trace_event.h" 10 #include "gpu/common/gpu_trace_event.h"
11 #include "ppapi/c/private/ppb_proxy_private.h" 11 #include "ppapi/c/private/ppb_proxy_private.h"
12 #include "ppapi/c/dev/ppb_var_deprecated.h" 12 #include "ppapi/c/dev/ppb_var_deprecated.h"
13 #include "ppapi/proxy/host_var_serialization_rules.h" 13 #include "ppapi/proxy/host_var_serialization_rules.h"
14 #include "ppapi/proxy/ppapi_messages.h" 14 #include "ppapi/proxy/ppapi_messages.h"
15 #include "ppapi/proxy/resource_creation_proxy.h"
15 16
16 namespace pp { 17 namespace pp {
17 namespace proxy { 18 namespace proxy {
18 19
19 namespace { 20 namespace {
20 21
21 typedef std::map<PP_Instance, HostDispatcher*> InstanceToDispatcherMap; 22 typedef std::map<PP_Instance, HostDispatcher*> InstanceToDispatcherMap;
22 InstanceToDispatcherMap* g_instance_to_dispatcher = NULL; 23 InstanceToDispatcherMap* g_instance_to_dispatcher = NULL;
23 24
24 typedef std::map<PP_Module, HostDispatcher*> ModuleToDispatcherMap; 25 typedef std::map<PP_Module, HostDispatcher*> ModuleToDispatcherMap;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // Handle common control messages. 159 // Handle common control messages.
159 if (Dispatcher::OnMessageReceived(msg)) 160 if (Dispatcher::OnMessageReceived(msg))
160 return true; 161 return true;
161 162
162 if (msg.routing_id() <= 0 && msg.routing_id() >= INTERFACE_ID_COUNT) { 163 if (msg.routing_id() <= 0 && msg.routing_id() >= INTERFACE_ID_COUNT) {
163 NOTREACHED(); 164 NOTREACHED();
164 // TODO(brettw): kill the plugin if it starts sending invalid messages? 165 // TODO(brettw): kill the plugin if it starts sending invalid messages?
165 return true; 166 return true;
166 } 167 }
167 168
169 // New-style function proxies.
170 // TODO(brettw) this is hacked in for the routing for the types we've
171 // implemented in this style so far. When everything is implemented in this
172 // style, this function should be cleaned up.
173 if (msg.routing_id() == INTERFACE_ID_RESOURCE_CREATION) {
174 ResourceCreationProxy proxy(this);
175 return proxy.OnMessageReceived(msg);
176 }
177
168 InterfaceProxy* proxy = target_proxies_[msg.routing_id()].get(); 178 InterfaceProxy* proxy = target_proxies_[msg.routing_id()].get();
169 if (!proxy) { 179 if (!proxy) {
170 // Autocreate any proxy objects to handle requests from the plugin. Since 180 // Autocreate any proxy objects to handle requests from the plugin. Since
171 // we always support all known PPB_* interfaces (modulo the trusted bit), 181 // we always support all known PPB_* interfaces (modulo the trusted bit),
172 // there's very little checking necessary. 182 // there's very little checking necessary.
173 const InterfaceProxy::Info* info = GetPPBInterfaceInfo( 183 const InterfaceProxy::Info* info = GetPPBInterfaceInfo(
174 static_cast<InterfaceID>(msg.routing_id())); 184 static_cast<InterfaceID>(msg.routing_id()));
175 if (!info || 185 if (!info ||
176 (info->is_trusted && disallow_trusted_interfaces())) 186 (info->is_trusted && disallow_trusted_interfaces()))
177 return true; 187 return true;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); 266 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module());
257 } 267 }
258 268
259 ScopedModuleReference::~ScopedModuleReference() { 269 ScopedModuleReference::~ScopedModuleReference() {
260 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); 270 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module());
261 } 271 }
262 272
263 } // namespace proxy 273 } // namespace proxy
264 } // namespace pp 274 } // namespace pp
265 275
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698