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

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

Issue 2239273002: Don't use SSLStatus from FrameHostMsg_DidCommitProvisionalLoad and instead cache it on the browser … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 3 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 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/loader/navigation_url_loader_impl_core.h" 5 #include "content/browser/loader/navigation_url_loader_impl_core.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/navigation_request_info.h" 10 #include "content/browser/frame_host/navigation_request_info.h"
11 #include "content/browser/loader/navigation_resource_handler.h" 11 #include "content/browser/loader/navigation_resource_handler.h"
12 #include "content/browser/loader/resource_dispatcher_host_impl.h" 12 #include "content/browser/loader/resource_dispatcher_host_impl.h"
13 #include "content/browser/service_worker/service_worker_context_wrapper.h" 13 #include "content/browser/service_worker/service_worker_context_wrapper.h"
14 #include "content/browser/service_worker/service_worker_registration.h" 14 #include "content/browser/service_worker/service_worker_registration.h"
15 #include "content/common/navigation_params.h" 15 #include "content/common/navigation_params.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/navigation_data.h" 17 #include "content/public/browser/navigation_data.h"
18 #include "content/public/browser/stream_handle.h" 18 #include "content/public/browser/stream_handle.h"
19 #include "content/public/common/resource_response.h" 19 #include "content/public/common/resource_response.h"
20 #include "content/public/common/ssl_status.h"
20 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
21 #include "net/url_request/redirect_info.h" 22 #include "net/url_request/redirect_info.h"
22 23
23 namespace content { 24 namespace content {
24 25
25 NavigationURLLoaderImplCore::NavigationURLLoaderImplCore( 26 NavigationURLLoaderImplCore::NavigationURLLoaderImplCore(
26 const base::WeakPtr<NavigationURLLoaderImpl>& loader) 27 const base::WeakPtr<NavigationURLLoaderImpl>& loader)
27 : loader_(loader), 28 : loader_(loader),
28 resource_handler_(nullptr), 29 resource_handler_(nullptr),
29 resource_context_(nullptr), 30 resource_context_(nullptr),
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // For the trace below we're using the NavigationURLLoaderImplCore as the 104 // For the trace below we're using the NavigationURLLoaderImplCore as the
104 // async trace id and reporting the new redirect URL as a parameter. 105 // async trace id and reporting the new redirect URL as a parameter.
105 TRACE_EVENT_ASYNC_BEGIN2("navigation", "Navigation redirectDelay", this, 106 TRACE_EVENT_ASYNC_BEGIN2("navigation", "Navigation redirectDelay", this,
106 "&NavigationURLLoaderImplCore", this, "New URL", 107 "&NavigationURLLoaderImplCore", this, "New URL",
107 redirect_info.new_url.spec()); 108 redirect_info.new_url.spec());
108 } 109 }
109 110
110 void NavigationURLLoaderImplCore::NotifyResponseStarted( 111 void NavigationURLLoaderImplCore::NotifyResponseStarted(
111 ResourceResponse* response, 112 ResourceResponse* response,
112 std::unique_ptr<StreamHandle> body, 113 std::unique_ptr<StreamHandle> body,
114 const SSLStatus& ssl_status,
113 std::unique_ptr<NavigationData> navigation_data) { 115 std::unique_ptr<NavigationData> navigation_data) {
114 DCHECK_CURRENTLY_ON(BrowserThread::IO); 116 DCHECK_CURRENTLY_ON(BrowserThread::IO);
115 TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this); 117 TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this);
116 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this, 118 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this,
117 "&NavigationURLLoaderImplCore", this, "success", true); 119 "&NavigationURLLoaderImplCore", this, "success", true);
118 120
119 // If, by the time the task reaches the UI thread, |loader_| has already been 121 // If, by the time the task reaches the UI thread, |loader_| has already been
120 // destroyed, NotifyResponseStarted will not run. |body| will be destructed 122 // destroyed, NotifyResponseStarted will not run. |body| will be destructed
121 // and the request released at that point. 123 // and the request released at that point.
122 124
123 // Make a copy of the ResourceResponse before it is passed to another thread. 125 // Make a copy of the ResourceResponse before it is passed to another thread.
124 // 126 //
125 // TODO(davidben): This copy could be avoided if ResourceResponse weren't 127 // TODO(davidben): This copy could be avoided if ResourceResponse weren't
126 // reference counted and the loader stack passed unique ownership of the 128 // reference counted and the loader stack passed unique ownership of the
127 // response. https://crbug.com/416050 129 // response. https://crbug.com/416050
128 BrowserThread::PostTask( 130 BrowserThread::PostTask(
129 BrowserThread::UI, FROM_HERE, 131 BrowserThread::UI, FROM_HERE,
130 base::Bind(&NavigationURLLoaderImpl::NotifyResponseStarted, loader_, 132 base::Bind(&NavigationURLLoaderImpl::NotifyResponseStarted, loader_,
131 response->DeepCopy(), base::Passed(&body), 133 response->DeepCopy(), base::Passed(&body), ssl_status,
132 base::Passed(&navigation_data))); 134 base::Passed(&navigation_data)));
133 } 135 }
134 136
135 void NavigationURLLoaderImplCore::NotifyRequestFailed(bool in_cache, 137 void NavigationURLLoaderImplCore::NotifyRequestFailed(bool in_cache,
136 int net_error) { 138 int net_error) {
137 DCHECK_CURRENTLY_ON(BrowserThread::IO); 139 DCHECK_CURRENTLY_ON(BrowserThread::IO);
138 TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this); 140 TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this);
139 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this, 141 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this,
140 "&NavigationURLLoaderImplCore", this, "success", 142 "&NavigationURLLoaderImplCore", this, "success",
141 false); 143 false);
(...skipping 23 matching lines...) Expand all
165 167
166 // The ResourceDispatcherHostImpl can be null in unit tests. 168 // The ResourceDispatcherHostImpl can be null in unit tests.
167 if (!ResourceDispatcherHostImpl::Get()) 169 if (!ResourceDispatcherHostImpl::Get())
168 return; 170 return;
169 171
170 ResourceDispatcherHostImpl::Get()->BeginNavigationRequest( 172 ResourceDispatcherHostImpl::Get()->BeginNavigationRequest(
171 resource_context_, *request_info_, this); 173 resource_context_, *request_info_, this);
172 } 174 }
173 175
174 } // namespace content 176 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698