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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 449 |
450 void ChannelMojo::ChannelInfoDeleter::operator()( | 450 void ChannelMojo::ChannelInfoDeleter::operator()( |
451 mojo::embedder::ChannelInfo* ptr) const { | 451 mojo::embedder::ChannelInfo* ptr) const { |
452 mojo::embedder::DestroyChannelOnIOThread(ptr); | 452 mojo::embedder::DestroyChannelOnIOThread(ptr); |
453 } | 453 } |
454 | 454 |
455 //------------------------------------------------------------------------------ | 455 //------------------------------------------------------------------------------ |
456 | 456 |
457 // static | 457 // static |
458 scoped_ptr<ChannelMojo> ChannelMojo::Create( | 458 scoped_ptr<ChannelMojo> ChannelMojo::Create( |
459 scoped_ptr<Channel> bootstrap, Mode mode, Listener* listener, | |
460 scoped_refptr<base::TaskRunner> io_thread_task_runner) { | |
461 return make_scoped_ptr(new ChannelMojo( | |
462 bootstrap.Pass(), mode, listener, io_thread_task_runner)); | |
463 } | |
464 | |
465 // static | |
466 scoped_ptr<ChannelMojo> ChannelMojo::Create( | |
467 const ChannelHandle &channel_handle, Mode mode, Listener* listener, | 459 const ChannelHandle &channel_handle, Mode mode, Listener* listener, |
468 scoped_refptr<base::TaskRunner> io_thread_task_runner) { | 460 scoped_refptr<base::TaskRunner> io_thread_task_runner) { |
469 return Create( | 461 return make_scoped_ptr(new ChannelMojo( |
470 Channel::Create(channel_handle, mode, g_null_listener.Pointer()), | 462 Channel::Create(channel_handle, mode, g_null_listener.Pointer()), |
471 mode, listener, io_thread_task_runner); | 463 mode, listener, io_thread_task_runner)); |
472 } | 464 } |
473 | 465 |
474 // static | 466 // static |
475 scoped_ptr<ChannelFactory> ChannelMojo::CreateFactory( | 467 scoped_ptr<ChannelFactory> ChannelMojo::CreateFactory( |
476 const ChannelHandle &channel_handle, Mode mode, | 468 const ChannelHandle &channel_handle, Mode mode, |
477 scoped_refptr<base::TaskRunner> io_thread_task_runner) { | 469 scoped_refptr<base::TaskRunner> io_thread_task_runner) { |
478 return make_scoped_ptr( | 470 return make_scoped_ptr( |
479 new MojoChannelFactory( | 471 new MojoChannelFactory( |
480 channel_handle, mode, | 472 channel_handle, mode, |
481 io_thread_task_runner)).PassAs<ChannelFactory>(); | 473 io_thread_task_runner)).PassAs<ChannelFactory>(); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 int ChannelMojo::GetClientFileDescriptor() const { | 579 int ChannelMojo::GetClientFileDescriptor() const { |
588 return bootstrap_->GetClientFileDescriptor(); | 580 return bootstrap_->GetClientFileDescriptor(); |
589 } | 581 } |
590 | 582 |
591 int ChannelMojo::TakeClientFileDescriptor() { | 583 int ChannelMojo::TakeClientFileDescriptor() { |
592 return bootstrap_->TakeClientFileDescriptor(); | 584 return bootstrap_->TakeClientFileDescriptor(); |
593 } | 585 } |
594 #endif // defined(OS_POSIX) && !defined(OS_NACL) | 586 #endif // defined(OS_POSIX) && !defined(OS_NACL) |
595 | 587 |
596 } // namespace IPC | 588 } // namespace IPC |
OLD | NEW |