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

Side by Side Diff: content/browser/loader/navigation_url_loader_network_service.cc

Issue 2813243002: network service: pass PlzNavigate resulting data via mojo data pipe (Closed)
Patch Set: . Created 3 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/loader/navigation_url_loader_network_service.h" 5 #include "content/browser/loader/navigation_url_loader_network_service.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "content/browser/frame_host/navigation_request_info.h" 8 #include "content/browser/frame_host/navigation_request_info.h"
9 #include "content/browser/loader/navigation_url_loader_delegate.h" 9 #include "content/browser/loader/navigation_url_loader_delegate.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/browser/global_request_id.h"
12 #include "content/public/browser/navigation_data.h"
11 #include "content/public/browser/navigation_ui_data.h" 13 #include "content/public/browser/navigation_ui_data.h"
14 #include "content/public/browser/ssl_status.h"
15 #include "content/public/browser/stream_handle.h"
12 #include "content/public/common/service_manager_connection.h" 16 #include "content/public/common/service_manager_connection.h"
13 #include "content/public/common/service_names.mojom.h" 17 #include "content/public/common/service_names.mojom.h"
14 #include "net/url_request/url_request_context.h" 18 #include "net/url_request/url_request_context.h"
15 #include "services/service_manager/public/cpp/connector.h" 19 #include "services/service_manager/public/cpp/connector.h"
16 20
17 namespace content { 21 namespace content {
18 22
19 NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService( 23 NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService(
20 ResourceContext* resource_context, 24 ResourceContext* resource_context,
21 StoragePartition* storage_partition, 25 StoragePartition* storage_partition,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 59
56 void NavigationURLLoaderNetworkService::FollowRedirect() { 60 void NavigationURLLoaderNetworkService::FollowRedirect() {
57 url_loader_associated_ptr_->FollowRedirect(); 61 url_loader_associated_ptr_->FollowRedirect();
58 } 62 }
59 63
60 void NavigationURLLoaderNetworkService::ProceedWithResponse() {} 64 void NavigationURLLoaderNetworkService::ProceedWithResponse() {}
61 65
62 void NavigationURLLoaderNetworkService::OnReceiveResponse( 66 void NavigationURLLoaderNetworkService::OnReceiveResponse(
63 const ResourceResponseHead& head, 67 const ResourceResponseHead& head,
64 mojom::DownloadedTempFilePtr downloaded_file) { 68 mojom::DownloadedTempFilePtr downloaded_file) {
65 // TODO(scottmg): This should mirror code in 69 // TODO(scottmg): This needs to do more of what
66 // NavigationResourceHandler::OnReponseStarted(). 70 // NavigationResourceHandler::OnReponseStarted() does. Or maybe in
71 // OnStartLoadingResponseBody().
72 response_ = new ResourceResponse();
dcheng 2017/04/12 21:18:16 Nit: base::MakeShared<ResourceResponse>();
scottmg 2017/04/12 21:28:50 Doh, more of them! Done. (For my edification... I
dcheng 2017/04/12 21:31:11 in my opinion, it's nice not to have a bare new, s
scottmg 2017/04/12 21:35:28 so ideally someday, the only bare 'new's would rep
73 response_->head = head;
67 } 74 }
68 75
69 void NavigationURLLoaderNetworkService::OnReceiveRedirect( 76 void NavigationURLLoaderNetworkService::OnReceiveRedirect(
70 const net::RedirectInfo& redirect_info, 77 const net::RedirectInfo& redirect_info,
71 const ResourceResponseHead& head) { 78 const ResourceResponseHead& head) {
72 DCHECK_CURRENTLY_ON(BrowserThread::UI); 79 DCHECK_CURRENTLY_ON(BrowserThread::UI);
73 scoped_refptr<ResourceResponse> response(new ResourceResponse()); 80 scoped_refptr<ResourceResponse> response(new ResourceResponse());
74 response->head = head; 81 response->head = head;
75 delegate_->OnRequestRedirected(redirect_info, response); 82 delegate_->OnRequestRedirected(redirect_info, response);
76 } 83 }
77 84
78 void NavigationURLLoaderNetworkService::OnDataDownloaded( 85 void NavigationURLLoaderNetworkService::OnDataDownloaded(
79 int64_t data_length, 86 int64_t data_length,
80 int64_t encoded_length) {} 87 int64_t encoded_length) {}
81 88
82 void NavigationURLLoaderNetworkService::OnUploadProgress( 89 void NavigationURLLoaderNetworkService::OnUploadProgress(
83 int64_t current_position, 90 int64_t current_position,
84 int64_t total_size, 91 int64_t total_size,
85 const OnUploadProgressCallback& callback) {} 92 const OnUploadProgressCallback& callback) {}
86 93
87 void NavigationURLLoaderNetworkService::OnReceiveCachedMetadata( 94 void NavigationURLLoaderNetworkService::OnReceiveCachedMetadata(
88 const std::vector<uint8_t>& data) {} 95 const std::vector<uint8_t>& data) {}
89 96
90 void NavigationURLLoaderNetworkService::OnTransferSizeUpdated( 97 void NavigationURLLoaderNetworkService::OnTransferSizeUpdated(
91 int32_t transfer_size_diff) {} 98 int32_t transfer_size_diff) {}
92 99
93 void NavigationURLLoaderNetworkService::OnStartLoadingResponseBody( 100 void NavigationURLLoaderNetworkService::OnStartLoadingResponseBody(
94 mojo::ScopedDataPipeConsumerHandle body) {} 101 mojo::ScopedDataPipeConsumerHandle body) {
102 DCHECK(response_);
103 // Temporarily, we pass both a stream (null) and the data pipe to the
104 // delegate until PlzNavigate has shipped and we can be comfortable fully
105 // switching to the data pipe.
106 delegate_->OnResponseStarted(
107 response_, std::unique_ptr<StreamHandle>(), std::move(body), SSLStatus(),
dcheng 2017/04/12 21:18:16 Nit: nullptr
scottmg 2017/04/12 21:28:50 Done.
108 std::unique_ptr<NavigationData>(), GlobalRequestID() /* request_id? */,
109 false /* is_download? */, false /* is_stream */);
110 }
95 111
96 void NavigationURLLoaderNetworkService::OnComplete( 112 void NavigationURLLoaderNetworkService::OnComplete(
97 const ResourceRequestCompletionStatus& completion_status) {} 113 const ResourceRequestCompletionStatus& completion_status) {}
98 114
99 } // namespace content 115 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698