OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
12 #include "base/location.h" | 13 #include "base/location.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
15 #include "base/synchronization/waitable_event_watcher.h" | 16 #include "base/synchronization/waitable_event_watcher.h" |
16 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
17 #include "base/threading/thread_local.h" | 18 #include "base/threading/thread_local.h" |
18 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 scoped_ptr<SyncChannel> SyncChannel::Create( | 410 scoped_ptr<SyncChannel> SyncChannel::Create( |
410 const IPC::ChannelHandle& channel_handle, | 411 const IPC::ChannelHandle& channel_handle, |
411 Channel::Mode mode, | 412 Channel::Mode mode, |
412 Listener* listener, | 413 Listener* listener, |
413 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, | 414 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, |
414 bool create_pipe_now, | 415 bool create_pipe_now, |
415 base::WaitableEvent* shutdown_event) { | 416 base::WaitableEvent* shutdown_event) { |
416 scoped_ptr<SyncChannel> channel = | 417 scoped_ptr<SyncChannel> channel = |
417 Create(listener, ipc_task_runner, shutdown_event); | 418 Create(listener, ipc_task_runner, shutdown_event); |
418 channel->Init(channel_handle, mode, create_pipe_now); | 419 channel->Init(channel_handle, mode, create_pipe_now); |
419 return channel.Pass(); | 420 return channel; |
420 } | 421 } |
421 | 422 |
422 // static | 423 // static |
423 scoped_ptr<SyncChannel> SyncChannel::Create( | 424 scoped_ptr<SyncChannel> SyncChannel::Create( |
424 scoped_ptr<ChannelFactory> factory, | 425 scoped_ptr<ChannelFactory> factory, |
425 Listener* listener, | 426 Listener* listener, |
426 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, | 427 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, |
427 bool create_pipe_now, | 428 bool create_pipe_now, |
428 base::WaitableEvent* shutdown_event) { | 429 base::WaitableEvent* shutdown_event) { |
429 scoped_ptr<SyncChannel> channel = | 430 scoped_ptr<SyncChannel> channel = |
430 Create(listener, ipc_task_runner, shutdown_event); | 431 Create(listener, ipc_task_runner, shutdown_event); |
431 channel->Init(factory.Pass(), create_pipe_now); | 432 channel->Init(std::move(factory), create_pipe_now); |
432 return channel.Pass(); | 433 return channel; |
433 } | 434 } |
434 | 435 |
435 // static | 436 // static |
436 scoped_ptr<SyncChannel> SyncChannel::Create( | 437 scoped_ptr<SyncChannel> SyncChannel::Create( |
437 Listener* listener, | 438 Listener* listener, |
438 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, | 439 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, |
439 WaitableEvent* shutdown_event) { | 440 WaitableEvent* shutdown_event) { |
440 return make_scoped_ptr( | 441 return make_scoped_ptr( |
441 new SyncChannel(listener, ipc_task_runner, shutdown_event)); | 442 new SyncChannel(listener, ipc_task_runner, shutdown_event)); |
442 } | 443 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 596 |
596 void SyncChannel::OnChannelInit() { | 597 void SyncChannel::OnChannelInit() { |
597 for (const auto& filter : pre_init_sync_message_filters_) { | 598 for (const auto& filter : pre_init_sync_message_filters_) { |
598 filter->set_is_channel_send_thread_safe( | 599 filter->set_is_channel_send_thread_safe( |
599 context()->IsChannelSendThreadSafe()); | 600 context()->IsChannelSendThreadSafe()); |
600 } | 601 } |
601 pre_init_sync_message_filters_.clear(); | 602 pre_init_sync_message_filters_.clear(); |
602 } | 603 } |
603 | 604 |
604 } // namespace IPC | 605 } // namespace IPC |
OLD | NEW |