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

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

Issue 2537593002: PlzNavigate: Pass move information along with the response started notification for navigation requ… (Closed)
Patch Set: . Created 4 years 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_navigation_handle_core.h " 13 #include "content/browser/service_worker/service_worker_navigation_handle_core.h "
14 #include "content/common/navigation_params.h" 14 #include "content/common/navigation_params.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/global_request_id.h"
16 #include "content/public/browser/navigation_data.h" 17 #include "content/public/browser/navigation_data.h"
17 #include "content/public/browser/navigation_ui_data.h" 18 #include "content/public/browser/navigation_ui_data.h"
18 #include "content/public/browser/ssl_status.h" 19 #include "content/public/browser/ssl_status.h"
19 #include "content/public/browser/stream_handle.h" 20 #include "content/public/browser/stream_handle.h"
20 #include "content/public/common/resource_response.h" 21 #include "content/public/common/resource_response.h"
21 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
22 #include "net/url_request/redirect_info.h" 23 #include "net/url_request/redirect_info.h"
23 24
24 namespace content { 25 namespace content {
25 26
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // async trace id and reporting the new redirect URL as a parameter. 94 // async trace id and reporting the new redirect URL as a parameter.
94 TRACE_EVENT_ASYNC_BEGIN2("navigation", "Navigation redirectDelay", this, 95 TRACE_EVENT_ASYNC_BEGIN2("navigation", "Navigation redirectDelay", this,
95 "&NavigationURLLoaderImplCore", this, "New URL", 96 "&NavigationURLLoaderImplCore", this, "New URL",
96 redirect_info.new_url.spec()); 97 redirect_info.new_url.spec());
97 } 98 }
98 99
99 void NavigationURLLoaderImplCore::NotifyResponseStarted( 100 void NavigationURLLoaderImplCore::NotifyResponseStarted(
100 ResourceResponse* response, 101 ResourceResponse* response,
101 std::unique_ptr<StreamHandle> body, 102 std::unique_ptr<StreamHandle> body,
102 const SSLStatus& ssl_status, 103 const SSLStatus& ssl_status,
103 std::unique_ptr<NavigationData> navigation_data) { 104 std::unique_ptr<NavigationData> navigation_data,
105 const GlobalRequestID& request_id,
106 bool is_download,
107 bool is_stream) {
104 DCHECK_CURRENTLY_ON(BrowserThread::IO); 108 DCHECK_CURRENTLY_ON(BrowserThread::IO);
105 TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this); 109 TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this);
106 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this, 110 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this,
107 "&NavigationURLLoaderImplCore", this, "success", true); 111 "&NavigationURLLoaderImplCore", this, "success", true);
108 112
109 // If, by the time the task reaches the UI thread, |loader_| has already been 113 // If, by the time the task reaches the UI thread, |loader_| has already been
110 // destroyed, NotifyResponseStarted will not run. |body| will be destructed 114 // destroyed, NotifyResponseStarted will not run. |body| will be destructed
111 // and the request released at that point. 115 // and the request released at that point.
112 116
113 // Make a copy of the ResourceResponse before it is passed to another thread. 117 // Make a copy of the ResourceResponse before it is passed to another thread.
114 // 118 //
115 // TODO(davidben): This copy could be avoided if ResourceResponse weren't 119 // TODO(davidben): This copy could be avoided if ResourceResponse weren't
116 // reference counted and the loader stack passed unique ownership of the 120 // reference counted and the loader stack passed unique ownership of the
117 // response. https://crbug.com/416050 121 // response. https://crbug.com/416050
118 BrowserThread::PostTask( 122 BrowserThread::PostTask(
119 BrowserThread::UI, FROM_HERE, 123 BrowserThread::UI, FROM_HERE,
120 base::Bind(&NavigationURLLoaderImpl::NotifyResponseStarted, loader_, 124 base::Bind(&NavigationURLLoaderImpl::NotifyResponseStarted, loader_,
121 response->DeepCopy(), base::Passed(&body), ssl_status, 125 response->DeepCopy(), base::Passed(&body), ssl_status,
122 base::Passed(&navigation_data))); 126 base::Passed(&navigation_data), request_id, is_download,
127 is_stream));
123 } 128 }
124 129
125 void NavigationURLLoaderImplCore::NotifyRequestFailed(bool in_cache, 130 void NavigationURLLoaderImplCore::NotifyRequestFailed(bool in_cache,
126 int net_error) { 131 int net_error) {
127 DCHECK_CURRENTLY_ON(BrowserThread::IO); 132 DCHECK_CURRENTLY_ON(BrowserThread::IO);
128 TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this); 133 TRACE_EVENT_ASYNC_END0("navigation", "Navigation redirectDelay", this);
129 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this, 134 TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this,
130 "&NavigationURLLoaderImplCore", this, "success", 135 "&NavigationURLLoaderImplCore", this, "success",
131 false); 136 false);
132 137
133 BrowserThread::PostTask( 138 BrowserThread::PostTask(
134 BrowserThread::UI, FROM_HERE, 139 BrowserThread::UI, FROM_HERE,
135 base::Bind(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_, 140 base::Bind(&NavigationURLLoaderImpl::NotifyRequestFailed, loader_,
136 in_cache, net_error)); 141 in_cache, net_error));
137 } 142 }
138 143
139 } // namespace content 144 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/navigation_url_loader_impl_core.h ('k') | content/test/test_navigation_url_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698