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

Side by Side Diff: ipc/ipc_sync_channel.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_sync_channel.h ('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 "ipc/ipc_sync_channel.h" 5 #include "ipc/ipc_sync_channel.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // message loops complete correctly. 222 // message loops complete correctly.
223 base::WaitableEventWatcher* top_send_done_watcher_; 223 base::WaitableEventWatcher* top_send_done_watcher_;
224 }; 224 };
225 225
226 base::LazyInstance<base::ThreadLocalPointer<SyncChannel::ReceivedSyncMsgQueue> > 226 base::LazyInstance<base::ThreadLocalPointer<SyncChannel::ReceivedSyncMsgQueue> >
227 SyncChannel::ReceivedSyncMsgQueue::lazy_tls_ptr_ = 227 SyncChannel::ReceivedSyncMsgQueue::lazy_tls_ptr_ =
228 LAZY_INSTANCE_INITIALIZER; 228 LAZY_INSTANCE_INITIALIZER;
229 229
230 SyncChannel::SyncContext::SyncContext( 230 SyncChannel::SyncContext::SyncContext(
231 Listener* listener, 231 Listener* listener,
232 base::SingleThreadTaskRunner* ipc_task_runner, 232 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
233 WaitableEvent* shutdown_event) 233 WaitableEvent* shutdown_event)
234 : ChannelProxy::Context(listener, ipc_task_runner), 234 : ChannelProxy::Context(listener, ipc_task_runner),
235 received_sync_msgs_(ReceivedSyncMsgQueue::AddContext()), 235 received_sync_msgs_(ReceivedSyncMsgQueue::AddContext()),
236 shutdown_event_(shutdown_event), 236 shutdown_event_(shutdown_event),
237 restrict_dispatch_group_(kRestrictDispatchGroup_None) { 237 restrict_dispatch_group_(kRestrictDispatchGroup_None) {
238 } 238 }
239 239
240 SyncChannel::SyncContext::~SyncContext() { 240 SyncChannel::SyncContext::~SyncContext() {
241 while (!deserializers_.empty()) 241 while (!deserializers_.empty())
242 Pop(); 242 Pop();
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 base::WaitableEventWatcher::EventCallback 403 base::WaitableEventWatcher::EventCallback
404 SyncChannel::SyncContext::MakeWaitableEventCallback() { 404 SyncChannel::SyncContext::MakeWaitableEventCallback() {
405 return base::Bind(&SyncChannel::SyncContext::OnWaitableEventSignaled, this); 405 return base::Bind(&SyncChannel::SyncContext::OnWaitableEventSignaled, this);
406 } 406 }
407 407
408 // static 408 // static
409 scoped_ptr<SyncChannel> SyncChannel::Create( 409 scoped_ptr<SyncChannel> SyncChannel::Create(
410 const IPC::ChannelHandle& channel_handle, 410 const IPC::ChannelHandle& channel_handle,
411 Channel::Mode mode, 411 Channel::Mode mode,
412 Listener* listener, 412 Listener* listener,
413 base::SingleThreadTaskRunner* ipc_task_runner, 413 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
414 bool create_pipe_now, 414 bool create_pipe_now,
415 base::WaitableEvent* shutdown_event) { 415 base::WaitableEvent* shutdown_event) {
416 scoped_ptr<SyncChannel> channel = 416 scoped_ptr<SyncChannel> channel =
417 Create(listener, ipc_task_runner, shutdown_event); 417 Create(listener, ipc_task_runner, shutdown_event);
418 channel->Init(channel_handle, mode, create_pipe_now); 418 channel->Init(channel_handle, mode, create_pipe_now);
419 return channel.Pass(); 419 return channel.Pass();
420 } 420 }
421 421
422 // static 422 // static
423 scoped_ptr<SyncChannel> SyncChannel::Create( 423 scoped_ptr<SyncChannel> SyncChannel::Create(
424 scoped_ptr<ChannelFactory> factory, 424 scoped_ptr<ChannelFactory> factory,
425 Listener* listener, 425 Listener* listener,
426 base::SingleThreadTaskRunner* ipc_task_runner, 426 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
427 bool create_pipe_now, 427 bool create_pipe_now,
428 base::WaitableEvent* shutdown_event) { 428 base::WaitableEvent* shutdown_event) {
429 scoped_ptr<SyncChannel> channel = 429 scoped_ptr<SyncChannel> channel =
430 Create(listener, ipc_task_runner, shutdown_event); 430 Create(listener, ipc_task_runner, shutdown_event);
431 channel->Init(factory.Pass(), create_pipe_now); 431 channel->Init(factory.Pass(), create_pipe_now);
432 return channel.Pass(); 432 return channel.Pass();
433 } 433 }
434 434
435 // static 435 // static
436 scoped_ptr<SyncChannel> SyncChannel::Create( 436 scoped_ptr<SyncChannel> SyncChannel::Create(
437 Listener* listener, 437 Listener* listener,
438 base::SingleThreadTaskRunner* ipc_task_runner, 438 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
439 WaitableEvent* shutdown_event) { 439 WaitableEvent* shutdown_event) {
440 return make_scoped_ptr( 440 return make_scoped_ptr(
441 new SyncChannel(listener, ipc_task_runner, shutdown_event)); 441 new SyncChannel(listener, ipc_task_runner, shutdown_event));
442 } 442 }
443 443
444 SyncChannel::SyncChannel( 444 SyncChannel::SyncChannel(
445 Listener* listener, 445 Listener* listener,
446 base::SingleThreadTaskRunner* ipc_task_runner, 446 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
447 WaitableEvent* shutdown_event) 447 WaitableEvent* shutdown_event)
448 : ChannelProxy(new SyncContext(listener, ipc_task_runner, shutdown_event)) { 448 : ChannelProxy(new SyncContext(listener, ipc_task_runner, shutdown_event)) {
449 // The current (listener) thread must be distinct from the IPC thread, or else 449 // The current (listener) thread must be distinct from the IPC thread, or else
450 // sending synchronous messages will deadlock. 450 // sending synchronous messages will deadlock.
451 DCHECK_NE(ipc_task_runner, base::ThreadTaskRunnerHandle::Get().get()); 451 DCHECK_NE(ipc_task_runner, base::ThreadTaskRunnerHandle::Get().get());
452 StartWatching(); 452 StartWatching();
453 } 453 }
454 454
455 SyncChannel::~SyncChannel() { 455 SyncChannel::~SyncChannel() {
456 } 456 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 // manual reset since the object watcher might otherwise reset the event 578 // manual reset since the object watcher might otherwise reset the event
579 // when we're doing a WaitMany. 579 // when we're doing a WaitMany.
580 dispatch_watcher_callback_ = 580 dispatch_watcher_callback_ =
581 base::Bind(&SyncChannel::OnWaitableEventSignaled, 581 base::Bind(&SyncChannel::OnWaitableEventSignaled,
582 base::Unretained(this)); 582 base::Unretained(this));
583 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), 583 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(),
584 dispatch_watcher_callback_); 584 dispatch_watcher_callback_);
585 } 585 }
586 586
587 } // namespace IPC 587 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_sync_channel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698