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

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

Issue 6628019: Ensure that PP_Instance values are unique within a plugin process in addition... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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
« no previous file with comments | « ppapi/proxy/plugin_dispatcher.h ('k') | ppapi/proxy/plugin_message_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/plugin_dispatcher.h" 5 #include "ppapi/proxy/plugin_dispatcher.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "ipc/ipc_message.h" 11 #include "ipc/ipc_message.h"
12 #include "ipc/ipc_sync_channel.h" 12 #include "ipc/ipc_sync_channel.h"
13 #include "ppapi/c/pp_errors.h" 13 #include "ppapi/c/pp_errors.h"
14 #include "ppapi/proxy/interface_proxy.h" 14 #include "ppapi/proxy/interface_proxy.h"
15 #include "ppapi/proxy/plugin_message_filter.h"
15 #include "ppapi/proxy/plugin_var_serialization_rules.h" 16 #include "ppapi/proxy/plugin_var_serialization_rules.h"
16 #include "ppapi/proxy/ppapi_messages.h" 17 #include "ppapi/proxy/ppapi_messages.h"
17 #include "ppapi/proxy/ppp_class_proxy.h" 18 #include "ppapi/proxy/ppp_class_proxy.h"
18 19
19 #if defined(OS_POSIX) 20 #if defined(OS_POSIX)
20 #include "base/eintr_wrapper.h" 21 #include "base/eintr_wrapper.h"
21 #include "ipc/ipc_channel_posix.h" 22 #include "ipc/ipc_channel_posix.h"
22 #endif 23 #endif
23 24
24 namespace pp { 25 namespace pp {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // static 66 // static
66 const void* PluginDispatcher::GetInterfaceFromDispatcher( 67 const void* PluginDispatcher::GetInterfaceFromDispatcher(
67 const char* interface) { 68 const char* interface) {
68 // All interfaces the plugin requests of the browser are "PPB". 69 // All interfaces the plugin requests of the browser are "PPB".
69 const InterfaceProxy::Info* info = GetPPBInterfaceInfo(interface); 70 const InterfaceProxy::Info* info = GetPPBInterfaceInfo(interface);
70 if (!info) 71 if (!info)
71 return NULL; 72 return NULL;
72 return info->interface; 73 return info->interface;
73 } 74 }
74 75
76 bool PluginDispatcher::InitWithChannel(
77 Delegate* delegate,
78 const IPC::ChannelHandle& channel_handle,
79 bool is_client) {
80 if (!Dispatcher::InitWithChannel(delegate, channel_handle, is_client))
81 return false;
82
83 // The message filter will intercept and process certain messages directly
84 // on the I/O thread.
85 channel()->AddFilter(
86 new PluginMessageFilter(delegate->GetGloballySeenInstanceIDSet()));
87 return true;
88 }
89
75 bool PluginDispatcher::IsPlugin() const { 90 bool PluginDispatcher::IsPlugin() const {
76 return true; 91 return true;
77 } 92 }
78 93
79 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { 94 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) {
80 // Handle common control messages. 95 // Handle common control messages.
81 if (Dispatcher::OnMessageReceived(msg)) 96 if (Dispatcher::OnMessageReceived(msg))
82 return true; 97 return true;
83 98
84 if (msg.routing_id() == MSG_ROUTING_CONTROL) { 99 if (msg.routing_id() == MSG_ROUTING_CONTROL) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 if (!interface_functions) 238 if (!interface_functions)
224 return; 239 return;
225 target_proxies_[info->id].reset( 240 target_proxies_[info->id].reset(
226 info->create_proxy(this, interface_functions)); 241 info->create_proxy(this, interface_functions));
227 *result = true; 242 *result = true;
228 } 243 }
229 244
230 } // namespace proxy 245 } // namespace proxy
231 } // namespace pp 246 } // namespace pp
232 247
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_dispatcher.h ('k') | ppapi/proxy/plugin_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698