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

Side by Side Diff: chrome/nacl/nacl_listener.cc

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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) 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 "chrome/nacl/nacl_listener.h" 5 #include "chrome/nacl/nacl_listener.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } else { 199 } else {
200 // This thread does not own the channel. 200 // This thread does not own the channel.
201 return filter_->Send(msg); 201 return filter_->Send(msg);
202 } 202 }
203 } 203 }
204 204
205 void NaClListener::Listen() { 205 void NaClListener::Listen() {
206 std::string channel_name = 206 std::string channel_name =
207 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 207 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
208 switches::kProcessChannelID); 208 switches::kProcessChannelID);
209 channel_.reset(new IPC::SyncChannel(this, io_thread_.message_loop_proxy(), 209 channel_.reset(new IPC::SyncChannel(
210 &shutdown_event_)); 210 this, io_thread_.message_loop_proxy().get(), &shutdown_event_));
211 filter_ = new IPC::SyncMessageFilter(&shutdown_event_); 211 filter_ = new IPC::SyncMessageFilter(&shutdown_event_);
212 channel_->AddFilter(filter_.get()); 212 channel_->AddFilter(filter_.get());
213 channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true); 213 channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true);
214 main_loop_ = base::MessageLoop::current(); 214 main_loop_ = base::MessageLoop::current();
215 main_loop_->Run(); 215 main_loop_->Run();
216 } 216 }
217 217
218 bool NaClListener::OnMessageReceived(const IPC::Message& msg) { 218 bool NaClListener::OnMessageReceived(const IPC::Message& msg) {
219 bool handled = true; 219 bool handled = true;
220 IPC_BEGIN_MESSAGE_MAP(NaClListener, msg) 220 IPC_BEGIN_MESSAGE_MAP(NaClListener, msg)
(...skipping 10 matching lines...) Expand all
231 return; 231 return;
232 } 232 }
233 233
234 if (params.enable_ipc_proxy) { 234 if (params.enable_ipc_proxy) {
235 // Create the initial PPAPI IPC channel between the NaCl IRT and the 235 // Create the initial PPAPI IPC channel between the NaCl IRT and the
236 // browser process. The IRT uses this channel to communicate with the 236 // browser process. The IRT uses this channel to communicate with the
237 // browser and to create additional IPC channels to renderer processes. 237 // browser and to create additional IPC channels to renderer processes.
238 IPC::ChannelHandle handle = 238 IPC::ChannelHandle handle =
239 IPC::Channel::GenerateVerifiedChannelID("nacl"); 239 IPC::Channel::GenerateVerifiedChannelID("nacl");
240 scoped_refptr<NaClIPCAdapter> ipc_adapter( 240 scoped_refptr<NaClIPCAdapter> ipc_adapter(
241 new NaClIPCAdapter(handle, io_thread_.message_loop_proxy())); 241 new NaClIPCAdapter(handle, io_thread_.message_loop_proxy().get()));
242 ipc_adapter->ConnectChannel(); 242 ipc_adapter->ConnectChannel();
243 243
244 // Pass a NaClDesc to the untrusted side. This will hold a ref to the 244 // Pass a NaClDesc to the untrusted side. This will hold a ref to the
245 // NaClIPCAdapter. 245 // NaClIPCAdapter.
246 args->initial_ipc_desc = ipc_adapter->MakeNaClDesc(); 246 args->initial_ipc_desc = ipc_adapter->MakeNaClDesc();
247 #if defined(OS_POSIX) 247 #if defined(OS_POSIX)
248 handle.socket = base::FileDescriptor( 248 handle.socket = base::FileDescriptor(
249 ipc_adapter->TakeClientFileDescriptor(), true); 249 ipc_adapter->TakeClientFileDescriptor(), true);
250 #endif 250 #endif
251 if (!Send(new NaClProcessHostMsg_PpapiChannelCreated(handle))) 251 if (!Send(new NaClProcessHostMsg_PpapiChannelCreated(handle)))
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 #if defined(OS_WIN) 309 #if defined(OS_WIN)
310 args->broker_duplicate_handle_func = BrokerDuplicateHandle; 310 args->broker_duplicate_handle_func = BrokerDuplicateHandle;
311 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; 311 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler;
312 #endif 312 #endif
313 #if defined(OS_LINUX) 313 #if defined(OS_LINUX)
314 args->prereserved_sandbox_size = prereserved_sandbox_size_; 314 args->prereserved_sandbox_size = prereserved_sandbox_size_;
315 #endif 315 #endif
316 NaClChromeMainStart(args); 316 NaClChromeMainStart(args);
317 NOTREACHED(); 317 NOTREACHED();
318 } 318 }
OLDNEW
« no previous file with comments | « chrome/nacl/nacl_ipc_adapter_unittest.cc ('k') | chrome/renderer/chrome_content_renderer_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698