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

Side by Side Diff: ipc/ipc_channel_proxy.cc

Issue 512153002: Manual fixups for scoped_refptr operator T* removal in ipc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | ipc/ipc_sync_channel.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) 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 "ipc/ipc_channel_proxy.h" 5 #include "ipc/ipc_channel_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "ipc/ipc_channel_factory.h" 14 #include "ipc/ipc_channel_factory.h"
15 #include "ipc/ipc_listener.h" 15 #include "ipc/ipc_listener.h"
16 #include "ipc/ipc_logging.h" 16 #include "ipc/ipc_logging.h"
17 #include "ipc/ipc_message_macros.h" 17 #include "ipc/ipc_message_macros.h"
18 #include "ipc/message_filter.h" 18 #include "ipc/message_filter.h"
19 #include "ipc/message_filter_router.h" 19 #include "ipc/message_filter_router.h"
20 20
21 namespace IPC { 21 namespace IPC {
22 22
23 //------------------------------------------------------------------------------ 23 //------------------------------------------------------------------------------
24 24
25 ChannelProxy::Context::Context(Listener* listener, 25 ChannelProxy::Context::Context(
26 base::SingleThreadTaskRunner* ipc_task_runner) 26 Listener* listener,
27 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner)
27 : listener_task_runner_(base::ThreadTaskRunnerHandle::Get()), 28 : listener_task_runner_(base::ThreadTaskRunnerHandle::Get()),
28 listener_(listener), 29 listener_(listener),
29 ipc_task_runner_(ipc_task_runner), 30 ipc_task_runner_(ipc_task_runner),
30 channel_connected_called_(false), 31 channel_connected_called_(false),
31 message_filter_router_(new MessageFilterRouter()), 32 message_filter_router_(new MessageFilterRouter()),
32 peer_pid_(base::kNullProcessId) { 33 peer_pid_(base::kNullProcessId) {
33 DCHECK(ipc_task_runner_.get()); 34 DCHECK(ipc_task_runner_.get());
34 // The Listener thread where Messages are handled must be a separate thread 35 // The Listener thread where Messages are handled must be a separate thread
35 // to avoid oversubscribing the IO thread. If you trigger this error, you 36 // to avoid oversubscribing the IO thread. If you trigger this error, you
36 // need to either: 37 // need to either:
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 listener_->OnBadMessageReceived(message); 303 listener_->OnBadMessageReceived(message);
303 } 304 }
304 305
305 //----------------------------------------------------------------------------- 306 //-----------------------------------------------------------------------------
306 307
307 // static 308 // static
308 scoped_ptr<ChannelProxy> ChannelProxy::Create( 309 scoped_ptr<ChannelProxy> ChannelProxy::Create(
309 const IPC::ChannelHandle& channel_handle, 310 const IPC::ChannelHandle& channel_handle,
310 Channel::Mode mode, 311 Channel::Mode mode,
311 Listener* listener, 312 Listener* listener,
312 base::SingleThreadTaskRunner* ipc_task_runner) { 313 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
313 scoped_ptr<ChannelProxy> channel(new ChannelProxy(listener, ipc_task_runner)); 314 scoped_ptr<ChannelProxy> channel(new ChannelProxy(listener, ipc_task_runner));
314 channel->Init(channel_handle, mode, true); 315 channel->Init(channel_handle, mode, true);
315 return channel.Pass(); 316 return channel.Pass();
316 } 317 }
317 318
318 // static 319 // static
319 scoped_ptr<ChannelProxy> ChannelProxy::Create( 320 scoped_ptr<ChannelProxy> ChannelProxy::Create(
320 scoped_ptr<ChannelFactory> factory, 321 scoped_ptr<ChannelFactory> factory,
321 Listener* listener, 322 Listener* listener,
322 base::SingleThreadTaskRunner* ipc_task_runner) { 323 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
323 scoped_ptr<ChannelProxy> channel(new ChannelProxy(listener, ipc_task_runner)); 324 scoped_ptr<ChannelProxy> channel(new ChannelProxy(listener, ipc_task_runner));
324 channel->Init(factory.Pass(), true); 325 channel->Init(factory.Pass(), true);
325 return channel.Pass(); 326 return channel.Pass();
326 } 327 }
327 328
328 ChannelProxy::ChannelProxy(Context* context) 329 ChannelProxy::ChannelProxy(Context* context)
329 : context_(context), 330 : context_(context),
330 did_init_(false) { 331 did_init_(false) {
331 } 332 }
332 333
333 ChannelProxy::ChannelProxy(Listener* listener, 334 ChannelProxy::ChannelProxy(
334 base::SingleThreadTaskRunner* ipc_task_runner) 335 Listener* listener,
336 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner)
335 : context_(new Context(listener, ipc_task_runner)), did_init_(false) { 337 : context_(new Context(listener, ipc_task_runner)), did_init_(false) {
336 } 338 }
337 339
338 ChannelProxy::~ChannelProxy() { 340 ChannelProxy::~ChannelProxy() {
339 DCHECK(CalledOnValidThread()); 341 DCHECK(CalledOnValidThread());
340 342
341 Close(); 343 Close();
342 } 344 }
343 345
344 void ChannelProxy::Init(const IPC::ChannelHandle& channel_handle, 346 void ChannelProxy::Init(const IPC::ChannelHandle& channel_handle,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 Channel* channel = context_.get()->channel_.get(); 452 Channel* channel = context_.get()->channel_.get();
451 // Channel must have been created first. 453 // Channel must have been created first.
452 DCHECK(channel) << context_.get()->channel_id_; 454 DCHECK(channel) << context_.get()->channel_id_;
453 return channel->TakeClientFileDescriptor(); 455 return channel->TakeClientFileDescriptor();
454 } 456 }
455 #endif 457 #endif
456 458
457 //----------------------------------------------------------------------------- 459 //-----------------------------------------------------------------------------
458 460
459 } // namespace IPC 461 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_proxy.h ('k') | ipc/ipc_sync_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698