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

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: Created 4 years, 10 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
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 44998359d6471848be4aeaa8caee6821506af5d2..b0f6834ae5b66f7cba19f8c65c53ea673a7813be 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -1919,7 +1919,7 @@ void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) {
base::TimeTicks::Now());
if (IsBrowserSideNavigationEnabled()) {
CommitNavigation(nullptr, nullptr, common_params,
- RequestNavigationParams());
+ RequestNavigationParams(), mojo::ScopedDataPipeConsumerHandle());
} else {
Navigate(common_params, StartNavigationParams(), RequestNavigationParams());
}
@@ -2049,8 +2049,9 @@ void RenderFrameHostImpl::CommitNavigation(
ResourceResponse* response,
scoped_ptr<StreamHandle> body,
const CommonNavigationParams& common_params,
- const RequestNavigationParams& request_params) {
- DCHECK((response && body.get()) ||
+ const RequestNavigationParams& request_params,
+ mojo::ScopedDataPipeConsumerHandle data_consumer_handle = mojo::ScopedDataPipeConsumerHandle()) {
+ DCHECK((response && (body.get() || data_consumer_handle.is_valid())) ||
!ShouldMakeNetworkRequestForURL(common_params.url));
UpdatePermissionsForNavigation(common_params, request_params);
@@ -2058,11 +2059,27 @@ void RenderFrameHostImpl::CommitNavigation(
// completing a RFH swap or unload handler.
SetState(RenderFrameHostImpl::STATE_DEFAULT);
+ // SENDS THE CONSUMER DATA HANDLE TO THE RENDERER VIA MOJO
+ // TODO: OPTIMIZE THIS
+ // - SEE IF THERE'S A WAY TO BIND THE SERVER EARLIER THEN THIS. Is there a
+ // notification received by the browser that a RenderFrame was created on the renderer?
+ // - POSSIBLY STORE THE 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), current_commit_id);
+ }
+
const GURL body_url = body.get() ? body->GetURL() : GURL();
const ResourceResponseHead head = response ?
response->head : ResourceResponseHead();
Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params,
- request_params));
+ request_params, current_commit_id));
// TODO(clamy): Release the stream handle once the renderer has finished
// reading it.

Powered by Google App Engine
This is Rietveld 408576698