forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
brianderson@chromium.org
committed
Apr 23, 2014
1 parent
0cfda30
commit 2442605
Showing
37 changed files
with
363 additions
and
471 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
content/browser/renderer_host/render_process_host_mojo_impl.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "content/browser/renderer_host/render_process_host_mojo_impl.h" | ||
|
||
#include "base/platform_file.h" | ||
#include "content/common/mojo/mojo_messages.h" | ||
#include "content/public/browser/browser_thread.h" | ||
#include "content/public/browser/render_process_host.h" | ||
#include "mojo/common/mojo_channel_init.h" | ||
#include "mojo/embedder/platform_channel_pair.h" | ||
|
||
namespace content { | ||
|
||
namespace { | ||
|
||
base::PlatformFile PlatformFileFromScopedPlatformHandle( | ||
mojo::embedder::ScopedPlatformHandle handle) { | ||
#if defined(OS_POSIX) | ||
return handle.release().fd; | ||
#elif defined(OS_WIN) | ||
return handle.release().handle; | ||
#endif | ||
} | ||
|
||
} // namespace | ||
|
||
struct RenderProcessHostMojoImpl::PendingHandle { | ||
PendingHandle() : view_routing_id(0) {} | ||
|
||
int32 view_routing_id; | ||
mojo::ScopedMessagePipeHandle handle; | ||
}; | ||
|
||
RenderProcessHostMojoImpl::RenderProcessHostMojoImpl(RenderProcessHost* host) | ||
: host_(host) { | ||
} | ||
|
||
RenderProcessHostMojoImpl::~RenderProcessHostMojoImpl() { | ||
} | ||
|
||
void RenderProcessHostMojoImpl::SetWebUIHandle( | ||
int32 view_routing_id, | ||
mojo::ScopedMessagePipeHandle handle) { | ||
base::ProcessHandle process = host_->GetHandle(); | ||
if (process != base::kNullProcessHandle) { | ||
CreateMojoChannel(process); // Does nothing if already connected. | ||
if (!render_process_mojo_.is_null()) { | ||
render_process_mojo_->SetWebUIHandle(view_routing_id, handle.Pass()); | ||
return; | ||
} | ||
} | ||
|
||
// Remember the request, we'll attempt to reconnect once the child process is | ||
// launched. | ||
pending_handle_.reset(new PendingHandle); | ||
pending_handle_->view_routing_id = view_routing_id; | ||
pending_handle_->handle = handle.Pass(); | ||
} | ||
|
||
void RenderProcessHostMojoImpl::OnProcessLaunched() { | ||
if (pending_handle_) { | ||
scoped_ptr<PendingHandle> handle(pending_handle_.Pass()); | ||
SetWebUIHandle(handle->view_routing_id, handle->handle.Pass()); | ||
} | ||
} | ||
|
||
|
||
void RenderProcessHostMojoImpl::CreateMojoChannel( | ||
base::ProcessHandle process_handle) { | ||
if (mojo_channel_init_.get()) | ||
return; | ||
|
||
mojo::embedder::PlatformChannelPair channel_pair; | ||
mojo_channel_init_.reset(new mojo::common::MojoChannelInit); | ||
mojo_channel_init_->Init( | ||
PlatformFileFromScopedPlatformHandle(channel_pair.PassServerHandle()), | ||
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | ||
if (!mojo_channel_init_->is_handle_valid()) | ||
return; | ||
base::PlatformFile client_file = | ||
PlatformFileFromScopedPlatformHandle(channel_pair.PassClientHandle()); | ||
host_->Send(new MojoMsg_ChannelCreated( | ||
IPC::GetFileHandleForProcess(client_file, process_handle, | ||
true))); | ||
ScopedRenderProcessMojoHandle render_process_handle( | ||
RenderProcessMojoHandle( | ||
mojo_channel_init_->bootstrap_message_pipe().release().value())); | ||
render_process_mojo_.reset(render_process_handle.Pass(), this); | ||
} | ||
|
||
} // namespace content |
Oops, something went wrong.