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

Side by Side Diff: content/browser/frame_host/navigation_request.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, 8 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 unified diff | Download patch
« no previous file with comments | « content/browser/frame_host/navigation_request.h ('k') | content/browser/frame_host/navigator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 9 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // TODO(clamy): pass the real value for |is_external_protocol| if needed. 258 // TODO(clamy): pass the real value for |is_external_protocol| if needed.
259 navigation_handle_->WillRedirectRequest( 259 navigation_handle_->WillRedirectRequest(
260 common_params_.url, common_params_.method == "POST", 260 common_params_.url, common_params_.method == "POST",
261 common_params_.referrer.url, false, response->head.headers, 261 common_params_.referrer.url, false, response->head.headers,
262 base::Bind(&NavigationRequest::OnRedirectChecksComplete, 262 base::Bind(&NavigationRequest::OnRedirectChecksComplete,
263 base::Unretained(this))); 263 base::Unretained(this)));
264 } 264 }
265 265
266 void NavigationRequest::OnResponseStarted( 266 void NavigationRequest::OnResponseStarted(
267 const scoped_refptr<ResourceResponse>& response, 267 const scoped_refptr<ResourceResponse>& response,
268 scoped_ptr<StreamHandle> body) { 268 mojo::ScopedDataPipeConsumerHandle data_consumer_handle,
269 int request_id) {
269 DCHECK(state_ == STARTED); 270 DCHECK(state_ == STARTED);
271 DCHECK(data_consumer_handle.is_valid());
272 DCHECK_LT(request_id, -1);
270 state_ = RESPONSE_STARTED; 273 state_ = RESPONSE_STARTED;
271 274
272 // Update the service worker params of the request params. 275 // Update the service worker params of the request params.
273 request_params_.should_create_service_worker = 276 request_params_.should_create_service_worker =
274 (frame_tree_node_->pending_sandbox_flags() & 277 (frame_tree_node_->pending_sandbox_flags() &
275 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin; 278 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin;
276 if (navigation_handle_->service_worker_handle()) { 279 if (navigation_handle_->service_worker_handle()) {
277 request_params_.service_worker_provider_id = 280 request_params_.service_worker_provider_id =
278 navigation_handle_->service_worker_handle() 281 navigation_handle_->service_worker_handle()
279 ->service_worker_provider_host_id(); 282 ->service_worker_provider_host_id();
280 } 283 }
281 284
282 // Update the lofi state of the request. 285 // Update the lofi state of the request.
283 if (response->head.is_using_lofi) 286 if (response->head.is_using_lofi)
284 common_params_.lofi_state = LOFI_ON; 287 common_params_.lofi_state = LOFI_ON;
285 else 288 else
286 common_params_.lofi_state = LOFI_OFF; 289 common_params_.lofi_state = LOFI_OFF;
287 290
288 frame_tree_node_->navigator()->CommitNavigation( 291 frame_tree_node_->navigator()->CommitNavigation(
289 this, response.get(), std::move(body)); 292 this, response.get(), std::move(data_consumer_handle), request_id);
290 } 293 }
291 294
292 void NavigationRequest::OnRequestFailed(bool has_stale_copy_in_cache, 295 void NavigationRequest::OnRequestFailed(bool has_stale_copy_in_cache,
293 int net_error) { 296 int net_error) {
294 DCHECK(state_ == STARTED); 297 DCHECK(state_ == STARTED);
295 state_ = FAILED; 298 state_ = FAILED;
296 navigation_handle_->set_net_error_code(static_cast<net::Error>(net_error)); 299 navigation_handle_->set_net_error_code(static_cast<net::Error>(net_error));
297 frame_tree_node_->navigator()->FailedNavigation( 300 frame_tree_node_->navigator()->FailedNavigation(
298 frame_tree_node_, has_stale_copy_in_cache, net_error); 301 frame_tree_node_, has_stale_copy_in_cache, net_error);
299 } 302 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 browser_context, navigating_frame_host->GetSiteInstance()); 369 browser_context, navigating_frame_host->GetSiteInstance());
367 DCHECK(partition); 370 DCHECK(partition);
368 371
369 ServiceWorkerContextWrapper* service_worker_context = 372 ServiceWorkerContextWrapper* service_worker_context =
370 static_cast<ServiceWorkerContextWrapper*>( 373 static_cast<ServiceWorkerContextWrapper*>(
371 partition->GetServiceWorkerContext()); 374 partition->GetServiceWorkerContext());
372 navigation_handle_->InitServiceWorkerHandle(service_worker_context); 375 navigation_handle_->InitServiceWorkerHandle(service_worker_context);
373 } 376 }
374 377
375 } // namespace content 378 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_request.h ('k') | content/browser/frame_host/navigator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698