Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1554)

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1693563002: PROTOTYPE: PlzNavigate: use a Mojo data pipe to stream navigation data to the renderer. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Browser sends URLRequest id to the renderer and renderer uses intermediary buffer for data: none he… Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/loader/mojo_stream_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index c945e389582606988424d09c98eee87703f3fd64..2396f38e790ea42ae2a5807b2900f7e09ffc6ff3 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -924,6 +924,9 @@ void RenderFrameHostImpl::OnDidFailLoadWithError(
// get a new page_id because we need to create a new navigation entry for that
// action.
void RenderFrameHostImpl::OnDidCommitProvisionalLoad(const IPC::Message& msg) {
+ LOG(ERROR)
+ << "RenderFrameHostImpl::OnDidCommitProvisionalLoad frame_tree_node_id: "
+ << frame_tree_node()->frame_tree_node_id();
RenderProcessHost* process = GetProcess();
// Read the parameters out of the IPC message directly to avoid making another
@@ -2016,8 +2019,8 @@ void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) {
FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF,
base::TimeTicks::Now(), "GET");
if (IsBrowserSideNavigationEnabled()) {
- CommitNavigation(nullptr, nullptr, common_params,
- RequestNavigationParams());
+ CommitNavigation(nullptr, common_params, RequestNavigationParams(),
+ mojo::ScopedDataPipeConsumerHandle(), -1);
} else {
Navigate(common_params, StartNavigationParams(), RequestNavigationParams());
}
@@ -2145,26 +2148,42 @@ void RenderFrameHostImpl::JavaScriptDialogClosed(
// PlzNavigate
void RenderFrameHostImpl::CommitNavigation(
ResourceResponse* response,
- scoped_ptr<StreamHandle> body,
const CommonNavigationParams& common_params,
- const RequestNavigationParams& request_params) {
- DCHECK((response && body.get()) ||
- !ShouldMakeNetworkRequestForURL(common_params.url));
+ const RequestNavigationParams& request_params,
+ // TODO(carlosk): these default parameters are a hack and has to go away.
+ mojo::ScopedDataPipeConsumerHandle data_consumer_handle =
+ mojo::ScopedDataPipeConsumerHandle(),
+ int request_id = -1) {
+ DCHECK((response && data_consumer_handle.is_valid()) ||
+ !ShouldMakeNetworkRequestForURL(common_params.url));
UpdatePermissionsForNavigation(common_params, request_params);
// Get back to a clean state, in case we start a new navigation without
// completing a RFH swap or unload handler.
SetState(RenderFrameHostImpl::STATE_DEFAULT);
- const GURL body_url = body.get() ? body->GetURL() : GURL();
+ // Sends the consumer data handle to the renderer via Mojo.
+ // TODO(carlosk): See if there's a way to bind the server earlier then this
+ // so that we don't have to wait for the binding to commit. Is there a
+ // notification received by the browser that a RenderFrame was created on the
+ // renderer?
+ // TODO(carlosk): possibly store the server reference somewhere. Is that even
+ // needed or is Mojo smart about caching bound remote references?
+ int32_t current_commit_id = -1;
+ if (data_consumer_handle.is_valid()) {
+ static int32_t commit_id = 0;
+ DataPipeConsumerHandleReceiverPtr consumer_receiver;
+ GetServiceRegistry()->ConnectToRemoteService(
+ mojo::GetProxy(&consumer_receiver));
+ current_commit_id = ++commit_id;
+ consumer_receiver->ReceiveDataPipeConsumerHandle(
+ std::move(data_consumer_handle), request_id, current_commit_id);
+ }
+
const ResourceResponseHead head = response ?
response->head : ResourceResponseHead();
- Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params,
- request_params));
-
- // TODO(clamy): Release the stream handle once the renderer has finished
- // reading it.
- stream_handle_ = std::move(body);
+ Send(new FrameMsg_CommitNavigation(routing_id_, head, GURL(), common_params,
+ request_params, current_commit_id));
// When navigating to a Javascript url, no commit is expected from the
// RenderFrameHost, nor should the throbber start. The NavigationRequest is
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/loader/mojo_stream_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698