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

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

Issue 11434042: PPAPI: Hook up Browser resource host stuff for NaCl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove debugging and handle conversion Created 8 years 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 | « content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 // Need to include this before most other files because it defines 9 // Need to include this before most other files because it defines
10 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define 10 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 virtual void SetActiveURL(const std::string& url) OVERRIDE; 78 virtual void SetActiveURL(const std::string& url) OVERRIDE;
79 79
80 // IPC::Listener implementation. 80 // IPC::Listener implementation.
81 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 81 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
82 82
83 private: 83 private:
84 void OnMsgCreateNaClChannel(int renderer_id, 84 void OnMsgCreateNaClChannel(int renderer_id,
85 const ppapi::PpapiPermissions& permissions, 85 const ppapi::PpapiPermissions& permissions,
86 bool incognito, 86 bool incognito,
87 SerializedHandle handle); 87 SerializedHandle handle);
88 void OnMsgResourceReply(
89 const ppapi::proxy::ResourceMessageReplyParams& reply_params,
90 const IPC::Message& nested_msg);
88 void OnPluginDispatcherMessageReceived(const IPC::Message& msg); 91 void OnPluginDispatcherMessageReceived(const IPC::Message& msg);
89 92
90 std::set<PP_Instance> instances_; 93 std::set<PP_Instance> instances_;
91 std::map<uint32, PluginDispatcher*> plugin_dispatchers_; 94 std::map<uint32, PluginDispatcher*> plugin_dispatchers_;
92 uint32 next_plugin_dispatcher_id_; 95 uint32 next_plugin_dispatcher_id_;
93 scoped_refptr<base::MessageLoopProxy> message_loop_; 96 scoped_refptr<base::MessageLoopProxy> message_loop_;
94 base::WaitableEvent shutdown_event_; 97 base::WaitableEvent shutdown_event_;
95 }; 98 };
96 99
97 PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop) 100 PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 NOTIMPLEMENTED(); 159 NOTIMPLEMENTED();
157 } 160 }
158 161
159 void PpapiDispatcher::SetActiveURL(const std::string& url) { 162 void PpapiDispatcher::SetActiveURL(const std::string& url) {
160 NOTIMPLEMENTED(); 163 NOTIMPLEMENTED();
161 } 164 }
162 165
163 bool PpapiDispatcher::OnMessageReceived(const IPC::Message& msg) { 166 bool PpapiDispatcher::OnMessageReceived(const IPC::Message& msg) {
164 IPC_BEGIN_MESSAGE_MAP(PpapiDispatcher, msg) 167 IPC_BEGIN_MESSAGE_MAP(PpapiDispatcher, msg)
165 IPC_MESSAGE_HANDLER(PpapiMsg_CreateNaClChannel, OnMsgCreateNaClChannel) 168 IPC_MESSAGE_HANDLER(PpapiMsg_CreateNaClChannel, OnMsgCreateNaClChannel)
169 IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnMsgResourceReply)
166 // All other messages are simply forwarded to a PluginDispatcher. 170 // All other messages are simply forwarded to a PluginDispatcher.
167 IPC_MESSAGE_UNHANDLED(OnPluginDispatcherMessageReceived(msg)) 171 IPC_MESSAGE_UNHANDLED(OnPluginDispatcherMessageReceived(msg))
168 IPC_END_MESSAGE_MAP() 172 IPC_END_MESSAGE_MAP()
169 return true; 173 return true;
170 } 174 }
171 175
172 void PpapiDispatcher::OnMsgCreateNaClChannel( 176 void PpapiDispatcher::OnMsgCreateNaClChannel(
173 int renderer_id, 177 int renderer_id,
174 const ppapi::PpapiPermissions& permissions, 178 const ppapi::PpapiPermissions& permissions,
175 bool incognito, 179 bool incognito,
176 SerializedHandle handle) { 180 SerializedHandle handle) {
177 // Tell the process-global GetInterface which interfaces it can return to the 181 // Tell the process-global GetInterface which interfaces it can return to the
178 // plugin. 182 // plugin.
179 ppapi::proxy::InterfaceList::SetProcessGlobalPermissions( 183 ppapi::proxy::InterfaceList::SetProcessGlobalPermissions(
180 permissions); 184 permissions);
181 185
182 PluginDispatcher* dispatcher = 186 PluginDispatcher* dispatcher =
183 new PluginDispatcher(::PPP_GetInterface, permissions, incognito); 187 new PluginDispatcher(::PPP_GetInterface, permissions, incognito);
184 // The channel handle's true name is not revealed here. 188 // The channel handle's true name is not revealed here.
185 IPC::ChannelHandle channel_handle("nacl", handle.descriptor()); 189 IPC::ChannelHandle channel_handle("nacl", handle.descriptor());
186 if (!dispatcher->InitPluginWithChannel(this, channel_handle, false)) { 190 if (!dispatcher->InitPluginWithChannel(this, channel_handle, false)) {
187 delete dispatcher; 191 delete dispatcher;
188 return; 192 return;
189 } 193 }
190 // From here, the dispatcher will manage its own lifetime according to the 194 // From here, the dispatcher will manage its own lifetime according to the
191 // lifetime of the attached channel. 195 // lifetime of the attached channel.
192 } 196 }
193 197
198 void PpapiDispatcher::OnMsgResourceReply(
199 const ppapi::proxy::ResourceMessageReplyParams& reply_params,
200 const IPC::Message& nested_msg) {
201 ppapi::proxy::PluginDispatcher::DispatchResourceReply(reply_params,
202 nested_msg);
203 }
204
194 void PpapiDispatcher::OnPluginDispatcherMessageReceived( 205 void PpapiDispatcher::OnPluginDispatcherMessageReceived(
195 const IPC::Message& msg) { 206 const IPC::Message& msg) {
196 // The first parameter should be a plugin dispatcher ID. 207 // The first parameter should be a plugin dispatcher ID.
197 PickleIterator iter(msg); 208 PickleIterator iter(msg);
198 uint32 id = 0; 209 uint32 id = 0;
199 if (!msg.ReadUInt32(&iter, &id)) { 210 if (!msg.ReadUInt32(&iter, &id)) {
200 NOTREACHED(); 211 NOTREACHED();
201 return; 212 return;
202 } 213 }
203 std::map<uint32, ppapi::proxy::PluginDispatcher*>::iterator dispatcher = 214 std::map<uint32, ppapi::proxy::PluginDispatcher*>::iterator dispatcher =
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 267
257 PpapiDispatcher ppapi_dispatcher(io_thread.message_loop_proxy()); 268 PpapiDispatcher ppapi_dispatcher(io_thread.message_loop_proxy());
258 plugin_globals.set_plugin_proxy_delegate(&ppapi_dispatcher); 269 plugin_globals.set_plugin_proxy_delegate(&ppapi_dispatcher);
259 270
260 loop.Run(); 271 loop.Run();
261 272
262 NaClSrpcModuleFini(); 273 NaClSrpcModuleFini();
263 274
264 return 0; 275 return 0;
265 } 276 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698