| Index: content/common/mojo/channel_init.cc
|
| diff --git a/content/common/mojo/channel_init.cc b/content/common/mojo/channel_init.cc
|
| index e81515c2da0eda8f573fd5a418817fed7b2c33c9..a57f3f9a45d81a45eab65feacce39ea6bf4b9552 100644
|
| --- a/content/common/mojo/channel_init.cc
|
| +++ b/content/common/mojo/channel_init.cc
|
| @@ -9,10 +9,16 @@
|
| #include "base/lazy_instance.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/thread_task_runner_handle.h"
|
| +
|
| +#if defined(USE_CHROME_EDK)
|
| +#include "mojo/edk/embedder/embedder.h"
|
| +#else
|
| #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
|
| +#endif
|
|
|
| namespace content {
|
|
|
| +#if !defined(USE_CHROME_EDK)
|
| ChannelInit::ChannelInit() : channel_info_(nullptr), weak_factory_(this) {}
|
|
|
| ChannelInit::~ChannelInit() {
|
| @@ -20,12 +26,20 @@ ChannelInit::~ChannelInit() {
|
| mojo::embedder::DestroyChannel(channel_info_,
|
| base::Bind(&base::DoNothing), nullptr);
|
| }
|
| +#endif
|
|
|
| mojo::ScopedMessagePipeHandle ChannelInit::Init(
|
| base::PlatformFile file,
|
| scoped_refptr<base::TaskRunner> io_thread_task_runner) {
|
| scoped_ptr<IPC::ScopedIPCSupport> ipc_support(
|
| new IPC::ScopedIPCSupport(io_thread_task_runner));
|
| +
|
| +#if defined(USE_CHROME_EDK)
|
| + mojo::ScopedMessagePipeHandle message_pipe(
|
| + mojo::edk::CreateMessagePipe(mojo::edk::ScopedPlatformHandle(
|
| + mojo::edk::PlatformHandle(file))));
|
| + return message_pipe.Pass();
|
| +#else
|
| mojo::ScopedMessagePipeHandle message_pipe =
|
| mojo::embedder::CreateChannel(
|
| mojo::embedder::ScopedPlatformHandle(
|
| @@ -35,20 +49,27 @@ mojo::ScopedMessagePipeHandle ChannelInit::Init(
|
| base::Passed(&ipc_support)),
|
| base::ThreadTaskRunnerHandle::Get()).Pass();
|
| return message_pipe.Pass();
|
| +#endif
|
| }
|
|
|
| void ChannelInit::WillDestroySoon() {
|
| +#if !defined(USE_CHROME_EDK)
|
| if (channel_info_)
|
| mojo::embedder::WillDestroyChannelSoon(channel_info_);
|
| +#endif
|
| }
|
|
|
| void ChannelInit::ShutdownOnIOThread() {
|
| +#if !defined(USE_CHROME_EDK)
|
| if (channel_info_)
|
| mojo::embedder::DestroyChannelOnIOThread(channel_info_);
|
| channel_info_ = nullptr;
|
| +#endif
|
| ipc_support_.reset();
|
| }
|
|
|
| +
|
| +#if !defined(USE_CHROME_EDK)
|
| // static
|
| void ChannelInit::OnCreatedChannel(
|
| base::WeakPtr<ChannelInit> self,
|
| @@ -65,5 +86,6 @@ void ChannelInit::OnCreatedChannel(
|
| self->channel_info_ = channel;
|
| self->ipc_support_ = ipc_support.Pass();
|
| }
|
| +#endif
|
|
|
| } // namespace content
|
|
|