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

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

Issue 6282007: First pass at making the proxy handle multiple renderers. This associates the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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_resource.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 } // namespace 31 } // namespace
32 32
33 PluginDispatcher::PluginDispatcher(base::ProcessHandle remote_process_handle, 33 PluginDispatcher::PluginDispatcher(base::ProcessHandle remote_process_handle,
34 GetInterfaceFunc get_interface, 34 GetInterfaceFunc get_interface,
35 InitModuleFunc init_module, 35 InitModuleFunc init_module,
36 ShutdownModuleFunc shutdown_module) 36 ShutdownModuleFunc shutdown_module)
37 : Dispatcher(remote_process_handle, get_interface), 37 : Dispatcher(remote_process_handle, get_interface),
38 init_module_(init_module), 38 init_module_(init_module),
39 shutdown_module_(shutdown_module), 39 shutdown_module_(shutdown_module) {
40 plugin_resource_tracker_(new PluginResourceTracker( 40 SetSerializationRules(new PluginVarSerializationRules);
41 ALLOW_THIS_IN_INITIALIZER_LIST(this))),
42 plugin_var_tracker_(new PluginVarTracker(
43 ALLOW_THIS_IN_INITIALIZER_LIST(this))) {
44 SetSerializationRules(
45 new PluginVarSerializationRules(plugin_var_tracker_.get()));
46 41
47 // As a plugin, we always support the PPP_Class interface. There's no 42 // As a plugin, we always support the PPP_Class interface. There's no
48 // GetInterface call or name for it, so we insert it into our table now. 43 // GetInterface call or name for it, so we insert it into our table now.
49 InjectProxy(INTERFACE_ID_PPP_CLASS, "$Internal_PPP_Class", 44 InjectProxy(INTERFACE_ID_PPP_CLASS, "$Internal_PPP_Class",
50 new PPP_Class_Proxy(this)); 45 new PPP_Class_Proxy(this));
51 } 46 }
52 47
53 PluginDispatcher::~PluginDispatcher() { 48 PluginDispatcher::~PluginDispatcher() {
54 if (shutdown_module_) 49 if (shutdown_module_)
55 shutdown_module_(); 50 shutdown_module_();
56 } 51 }
57 52
58 // static 53 // static
59 PluginDispatcher* PluginDispatcher::Get() { 54 PluginDispatcher* PluginDispatcher::Get() {
60 return g_dispatcher; 55 return g_dispatcher;
61 } 56 }
62 57
63 // static 58 // static
64 void PluginDispatcher::SetGlobal(PluginDispatcher* dispatcher) { 59 void PluginDispatcher::SetGlobal(PluginDispatcher* dispatcher) {
65 DCHECK(!dispatcher || !g_dispatcher); 60 DCHECK(!dispatcher || !g_dispatcher);
66 g_dispatcher = dispatcher; 61 g_dispatcher = dispatcher;
67 } 62 }
68 63
64 // static
65 PluginDispatcher* PluginDispatcher::GetForInstance(PP_Instance instance) {
66 // TODO(brettw) implement "real" per-instance dispatcher map.
67 DCHECK(instance != 0);
68 return Get();
69 }
70
69 bool PluginDispatcher::IsPlugin() const { 71 bool PluginDispatcher::IsPlugin() const {
70 return true; 72 return true;
71 } 73 }
72 74
73 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { 75 bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) {
74 if (msg.routing_id() == MSG_ROUTING_CONTROL) { 76 if (msg.routing_id() == MSG_ROUTING_CONTROL) {
75 // Handle some plugin-specific control messages. 77 // Handle some plugin-specific control messages.
76 bool handled = true; 78 bool handled = true;
77 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) 79 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg)
78 IPC_MESSAGE_HANDLER(PpapiMsg_InitializeModule, OnMsgInitializeModule) 80 IPC_MESSAGE_HANDLER(PpapiMsg_InitializeModule, OnMsgInitializeModule)
(...skipping 17 matching lines...) Expand all
96 98
97 void PluginDispatcher::OnMsgShutdown() { 99 void PluginDispatcher::OnMsgShutdown() {
98 if (shutdown_module_) 100 if (shutdown_module_)
99 shutdown_module_(); 101 shutdown_module_();
100 MessageLoop::current()->Quit(); 102 MessageLoop::current()->Quit();
101 } 103 }
102 104
103 } // namespace proxy 105 } // namespace proxy
104 } // namespace pp 106 } // namespace pp
105 107
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_dispatcher.h ('k') | ppapi/proxy/plugin_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698