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

Side by Side Diff: ipc/ipc_sync_channel.cc

Issue 382333002: Introduce ChannelMojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 "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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "base/synchronization/waitable_event_watcher.h" 13 #include "base/synchronization/waitable_event_watcher.h"
14 #include "base/thread_task_runner_handle.h" 14 #include "base/thread_task_runner_handle.h"
15 #include "base/threading/thread_local.h" 15 #include "base/threading/thread_local.h"
16 #include "ipc/ipc_channel_factory.h"
16 #include "ipc/ipc_logging.h" 17 #include "ipc/ipc_logging.h"
17 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
18 #include "ipc/ipc_sync_message.h" 19 #include "ipc/ipc_sync_message.h"
19 20
20 using base::TimeDelta; 21 using base::TimeDelta;
21 using base::TimeTicks; 22 using base::TimeTicks;
22 using base::WaitableEvent; 23 using base::WaitableEvent;
23 24
24 namespace IPC { 25 namespace IPC {
25 // When we're blocked in a Send(), we need to process incoming synchronous 26 // When we're blocked in a Send(), we need to process incoming synchronous
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 bool create_pipe_now, 414 bool create_pipe_now,
414 base::WaitableEvent* shutdown_event) { 415 base::WaitableEvent* shutdown_event) {
415 scoped_ptr<SyncChannel> channel = 416 scoped_ptr<SyncChannel> channel =
416 Create(listener, ipc_task_runner, shutdown_event); 417 Create(listener, ipc_task_runner, shutdown_event);
417 channel->Init(channel_handle, mode, create_pipe_now); 418 channel->Init(channel_handle, mode, create_pipe_now);
418 return channel.Pass(); 419 return channel.Pass();
419 } 420 }
420 421
421 // static 422 // static
422 scoped_ptr<SyncChannel> SyncChannel::Create( 423 scoped_ptr<SyncChannel> SyncChannel::Create(
424 scoped_ptr<ChannelFactory> factory,
425 Listener* listener,
426 base::SingleThreadTaskRunner* ipc_task_runner,
427 bool create_pipe_now,
428 base::WaitableEvent* shutdown_event) {
429 scoped_ptr<SyncChannel> channel =
430 Create(listener, ipc_task_runner, shutdown_event);
431 channel->Init(factory.Pass(), create_pipe_now);
432 return channel.Pass();
433 }
434
435 // static
436 scoped_ptr<SyncChannel> SyncChannel::Create(
423 Listener* listener, 437 Listener* listener,
424 base::SingleThreadTaskRunner* ipc_task_runner, 438 base::SingleThreadTaskRunner* ipc_task_runner,
425 WaitableEvent* shutdown_event) { 439 WaitableEvent* shutdown_event) {
426 return make_scoped_ptr( 440 return make_scoped_ptr(
427 new SyncChannel(listener, ipc_task_runner, shutdown_event)); 441 new SyncChannel(listener, ipc_task_runner, shutdown_event));
428 } 442 }
429 443
430 SyncChannel::SyncChannel( 444 SyncChannel::SyncChannel(
431 Listener* listener, 445 Listener* listener,
432 base::SingleThreadTaskRunner* ipc_task_runner, 446 base::SingleThreadTaskRunner* ipc_task_runner,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 // manual reset since the object watcher might otherwise reset the event 578 // manual reset since the object watcher might otherwise reset the event
565 // when we're doing a WaitMany. 579 // when we're doing a WaitMany.
566 dispatch_watcher_callback_ = 580 dispatch_watcher_callback_ =
567 base::Bind(&SyncChannel::OnWaitableEventSignaled, 581 base::Bind(&SyncChannel::OnWaitableEventSignaled,
568 base::Unretained(this)); 582 base::Unretained(this));
569 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), 583 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(),
570 dispatch_watcher_callback_); 584 dispatch_watcher_callback_);
571 } 585 }
572 586
573 } // namespace IPC 587 } // namespace IPC
OLDNEW
« ipc/ipc_channel.h ('K') | « ipc/ipc_sync_channel.h ('k') | ipc/ipc_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698