diff options
author | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-23 19:44:12 +0000 |
---|---|---|
committer | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-23 19:44:12 +0000 |
commit | 2442605058353f23d08db64f39cff92c48f7e8e6 (patch) | |
tree | ebf320d62c8b12271629e9c9619eefd0f07d4562 /mojo/common | |
parent | 0cfda3032843c4769cbd68ddc3c83e1753d0e611 (diff) | |
download | chromium_src-2442605058353f23d08db64f39cff92c48f7e8e6.zip chromium_src-2442605058353f23d08db64f39cff92c48f7e8e6.tar.gz chromium_src-2442605058353f23d08db64f39cff92c48f7e8e6.tar.bz2 |
Revert 265693 "Move Mojo channel initialization closer to IPC::C..."
This is causing runhooks failures on the iOS build bots.
> Move Mojo channel initialization closer to IPC::Channel setup
>
> This CL introduces two new content classes:
> - MojoApplicationHost encapsulates what's needed to host a Mojo App using Chrome IPC to bootstrap.
> - MojoApplication represents what's needed to be a Mojo App using Chrome IPC to bootstrap.
>
> The RenderProcess and RenderProcessHost interfaces are replaced with WebUISetup and WebUISetupClient interfaces. This way the interface is more specific to the service of setting up WebUI.
>
> WebUISetupClient is empty and uninteresting. RenderProcessHostImpl no longer deals with WebUI setup. That is all done directly by RenderViewHostImpl by talking to the WebUISetup service.
>
> Service names get defined in content/common/mojo/mojo_service_names.{h,cc}.
>
> R=sky@chromium.org, tsepez@chromium.org
>
> Review URL: https://codereview.chromium.org/236813002
TBR=darin@chromium.org
Review URL: https://codereview.chromium.org/247953005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265705 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/common')
-rw-r--r-- | mojo/common/mojo_channel_init.cc (renamed from mojo/common/channel_init.cc) | 18 | ||||
-rw-r--r-- | mojo/common/mojo_channel_init.h (renamed from mojo/common/channel_init.h) | 37 |
2 files changed, 31 insertions, 24 deletions
diff --git a/mojo/common/channel_init.cc b/mojo/common/mojo_channel_init.cc index 7eef2ae..96190f9 100644 --- a/mojo/common/channel_init.cc +++ b/mojo/common/mojo_channel_init.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "mojo/common/channel_init.h" +#include "mojo/common/mojo_channel_init.h" #include "base/bind.h" #include "base/message_loop/message_loop.h" @@ -11,12 +11,13 @@ namespace mojo { namespace common { -ChannelInit::ChannelInit() +MojoChannelInit::MojoChannelInit() : channel_info_(NULL), weak_factory_(this) { } -ChannelInit::~ChannelInit() { +MojoChannelInit::~MojoChannelInit() { + bootstrap_message_pipe_.reset(); if (channel_info_) { io_thread_task_runner_->PostTask( FROM_HERE, @@ -24,24 +25,23 @@ ChannelInit::~ChannelInit() { } } -mojo::ScopedMessagePipeHandle ChannelInit::Init( +void MojoChannelInit::Init( base::PlatformFile file, scoped_refptr<base::TaskRunner> io_thread_task_runner) { DCHECK(!io_thread_task_runner_.get()); // Should only init once. io_thread_task_runner_ = io_thread_task_runner; - mojo::ScopedMessagePipeHandle message_pipe = mojo::embedder::CreateChannel( + bootstrap_message_pipe_ = mojo::embedder::CreateChannel( mojo::embedder::ScopedPlatformHandle( mojo::embedder::PlatformHandle(file)), io_thread_task_runner, - base::Bind(&ChannelInit::OnCreatedChannel, weak_factory_.GetWeakPtr(), + base::Bind(&MojoChannelInit::OnCreatedChannel, weak_factory_.GetWeakPtr(), io_thread_task_runner), base::MessageLoop::current()->message_loop_proxy()).Pass(); - return message_pipe.Pass(); } // static -void ChannelInit::OnCreatedChannel( - base::WeakPtr<ChannelInit> host, +void MojoChannelInit::OnCreatedChannel( + base::WeakPtr<MojoChannelInit> host, scoped_refptr<base::TaskRunner> io_thread, embedder::ChannelInfo* channel) { // By the time we get here |host| may have been destroyed. If so, shutdown the diff --git a/mojo/common/channel_init.h b/mojo/common/mojo_channel_init.h index ca134cb..8fa0094 100644 --- a/mojo/common/channel_init.h +++ b/mojo/common/mojo_channel_init.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MOJO_COMMON_CHANNEL_INIT_H_ -#define MOJO_COMMON_CHANNEL_INIT_H_ +#ifndef MOJO_COMMON_MOJO_CHANNEL_INIT_H_ +#define MOJO_COMMON_MOJO_CHANNEL_INIT_H_ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -23,23 +23,27 @@ struct ChannelInfo; namespace common { -// ChannelInit handle creation (and destruction) of the mojo channel. It is +// MojoChannelInit handle creation (and destruction) of the mojo channel. It is // expected that this class is created and destroyed on the main thread. -class MOJO_COMMON_EXPORT ChannelInit { +class MOJO_COMMON_EXPORT MojoChannelInit { public: - ChannelInit(); - ~ChannelInit(); + MojoChannelInit(); + ~MojoChannelInit(); - // Initializes the channel. This takes ownership of |file|. Returns the - // primordial MessagePipe for the channel. - mojo::ScopedMessagePipeHandle Init( - base::PlatformFile file, - scoped_refptr<base::TaskRunner> io_thread_task_runner); + // Inits the channel. This takes ownership of |file|. + void Init(base::PlatformFile file, + scoped_refptr<base::TaskRunner> io_thread_task_runner); + + bool is_handle_valid() const { return bootstrap_message_pipe_.is_valid(); } + + mojo::ScopedMessagePipeHandle bootstrap_message_pipe() { + return bootstrap_message_pipe_.Pass(); + } private: // Invoked on the main thread once the channel has been established. static void OnCreatedChannel( - base::WeakPtr<ChannelInit> host, + base::WeakPtr<MojoChannelInit> host, scoped_refptr<base::TaskRunner> io_thread, embedder::ChannelInfo* channel); @@ -48,12 +52,15 @@ class MOJO_COMMON_EXPORT ChannelInit { // If non-null the channel has been established. embedder::ChannelInfo* channel_info_; - base::WeakPtrFactory<ChannelInit> weak_factory_; + // The handle from channel creation. + mojo::ScopedMessagePipeHandle bootstrap_message_pipe_; + + base::WeakPtrFactory<MojoChannelInit> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(ChannelInit); + DISALLOW_COPY_AND_ASSIGN(MojoChannelInit); }; } // namespace common } // namespace mojo -#endif // MOJO_COMMON_CHANNEL_INIT_H_ +#endif // MOJO_COMMON_MOJO_CHANNEL_INIT_H_ |