OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/mojo/ipc_channel_mojo.h" | 5 #include "ipc/mojo/ipc_channel_mojo.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "ipc/ipc_listener.h" | 10 #include "ipc/ipc_listener.h" |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 scoped_refptr<base::TaskRunner> io_thread_task_runner) { | 477 scoped_refptr<base::TaskRunner> io_thread_task_runner) { |
478 return make_scoped_ptr( | 478 return make_scoped_ptr( |
479 new MojoChannelFactory( | 479 new MojoChannelFactory( |
480 channel_handle, mode, | 480 channel_handle, mode, |
481 io_thread_task_runner)).PassAs<ChannelFactory>(); | 481 io_thread_task_runner)).PassAs<ChannelFactory>(); |
482 } | 482 } |
483 | 483 |
484 ChannelMojo::ChannelMojo( | 484 ChannelMojo::ChannelMojo( |
485 scoped_ptr<Channel> bootstrap, Mode mode, Listener* listener, | 485 scoped_ptr<Channel> bootstrap, Mode mode, Listener* listener, |
486 scoped_refptr<base::TaskRunner> io_thread_task_runner) | 486 scoped_refptr<base::TaskRunner> io_thread_task_runner) |
487 : weak_factory_(this), | 487 : bootstrap_(bootstrap.Pass()), |
488 bootstrap_(bootstrap.Pass()), | |
489 mode_(mode), listener_(listener), | 488 mode_(mode), listener_(listener), |
490 peer_pid_(base::kNullProcessId) { | 489 peer_pid_(base::kNullProcessId), |
| 490 weak_factory_(this) { |
491 if (base::MessageLoopProxy::current() == io_thread_task_runner.get()) { | 491 if (base::MessageLoopProxy::current() == io_thread_task_runner.get()) { |
492 InitOnIOThread(); | 492 InitOnIOThread(); |
493 } else { | 493 } else { |
494 io_thread_task_runner->PostTask(FROM_HERE, | 494 io_thread_task_runner->PostTask(FROM_HERE, |
495 base::Bind(&ChannelMojo::InitOnIOThread, | 495 base::Bind(&ChannelMojo::InitOnIOThread, |
496 weak_factory_.GetWeakPtr())); | 496 weak_factory_.GetWeakPtr())); |
497 } | 497 } |
498 } | 498 } |
499 | 499 |
500 ChannelMojo::~ChannelMojo() { | 500 ChannelMojo::~ChannelMojo() { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 int ChannelMojo::GetClientFileDescriptor() const { | 587 int ChannelMojo::GetClientFileDescriptor() const { |
588 return bootstrap_->GetClientFileDescriptor(); | 588 return bootstrap_->GetClientFileDescriptor(); |
589 } | 589 } |
590 | 590 |
591 int ChannelMojo::TakeClientFileDescriptor() { | 591 int ChannelMojo::TakeClientFileDescriptor() { |
592 return bootstrap_->TakeClientFileDescriptor(); | 592 return bootstrap_->TakeClientFileDescriptor(); |
593 } | 593 } |
594 #endif // defined(OS_POSIX) && !defined(OS_NACL) | 594 #endif // defined(OS_POSIX) && !defined(OS_NACL) |
595 | 595 |
596 } // namespace IPC | 596 } // namespace IPC |
OLD | NEW |