Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading |
| 6 | 6 |
| 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 // This method is called in the UI thread to send the timestamp of a resource | 427 // This method is called in the UI thread to send the timestamp of a resource |
| 428 // request to the respective Navigator (for an UMA histogram). | 428 // request to the respective Navigator (for an UMA histogram). |
| 429 void LogResourceRequestTimeOnUI( | 429 void LogResourceRequestTimeOnUI( |
| 430 base::TimeTicks timestamp, | 430 base::TimeTicks timestamp, |
| 431 int render_process_id, | 431 int render_process_id, |
| 432 int render_frame_id, | 432 int render_frame_id, |
| 433 const GURL& url) { | 433 const GURL& url) { |
| 434 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 434 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 435 RenderFrameHostImpl* host = | 435 RenderFrameHostImpl* host = |
| 436 RenderFrameHostImpl::FromID(render_process_id, render_frame_id); | 436 RenderFrameHostImpl::FromID(render_process_id, render_frame_id); |
| 437 if (host != NULL) { | 437 if (host != nullptr) { |
| 438 DCHECK(host->frame_tree_node()->IsMainFrame()); | 438 DCHECK(host->frame_tree_node()->IsMainFrame()); |
| 439 host->frame_tree_node()->navigator()->LogResourceRequestTime( | 439 host->frame_tree_node()->navigator()->LogResourceRequestTime( |
| 440 timestamp, url); | 440 timestamp, url); |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 | 443 |
| 444 bool IsUsingLoFi(LoFiState lofi_state, | 444 bool IsUsingLoFi(LoFiState lofi_state, |
| 445 ResourceDispatcherHostDelegate* delegate, | 445 ResourceDispatcherHostDelegate* delegate, |
| 446 const net::URLRequest& request, | 446 const net::URLRequest& request, |
| 447 ResourceContext* resource_context) { | 447 ResourceContext* resource_context) { |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1112 void ResourceDispatcherHostImpl::OnRequestResource( | 1112 void ResourceDispatcherHostImpl::OnRequestResource( |
| 1113 int routing_id, | 1113 int routing_id, |
| 1114 int request_id, | 1114 int request_id, |
| 1115 const ResourceHostMsg_Request& request_data) { | 1115 const ResourceHostMsg_Request& request_data) { |
| 1116 // TODO(pkasting): Remove ScopedTracker below once crbug.com/477117 is fixed. | 1116 // TODO(pkasting): Remove ScopedTracker below once crbug.com/477117 is fixed. |
| 1117 tracked_objects::ScopedTracker tracking_profile( | 1117 tracked_objects::ScopedTracker tracking_profile( |
| 1118 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 1118 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1119 "477117 ResourceDispatcherHostImpl::OnRequestResource")); | 1119 "477117 ResourceDispatcherHostImpl::OnRequestResource")); |
| 1120 // When logging time-to-network only care about main frame and non-transfer | 1120 // When logging time-to-network only care about main frame and non-transfer |
| 1121 // navigations. | 1121 // navigations. |
| 1122 // PlzNavigate: this log happens from |NavigationRequest::OnRequestStarted| | |
|
clamy
2015/12/18 15:42:11
nit: no ||? I think we prefer to use those for arg
carlosk
2015/12/18 17:23:21
Done.
| |
| 1123 // instead. | |
| 1122 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME && | 1124 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME && |
| 1123 request_data.transferred_request_request_id == -1 && | 1125 request_data.transferred_request_request_id == -1 && |
| 1124 !IsBrowserSideNavigationEnabled()) { | 1126 !IsBrowserSideNavigationEnabled()) { |
| 1125 BrowserThread::PostTask( | 1127 BrowserThread::PostTask( |
| 1126 BrowserThread::UI, | 1128 BrowserThread::UI, |
| 1127 FROM_HERE, | 1129 FROM_HERE, |
| 1128 base::Bind(&LogResourceRequestTimeOnUI, | 1130 base::Bind(&LogResourceRequestTimeOnUI, |
| 1129 TimeTicks::Now(), | 1131 TimeTicks::Now(), |
| 1130 filter_->child_id(), | 1132 filter_->child_id(), |
| 1131 request_data.render_frame_id, | 1133 request_data.render_frame_id, |
| (...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2531 load_flags |= net::LOAD_PREFETCH; | 2533 load_flags |= net::LOAD_PREFETCH; |
| 2532 } | 2534 } |
| 2533 | 2535 |
| 2534 if (is_sync_load) | 2536 if (is_sync_load) |
| 2535 load_flags |= net::LOAD_IGNORE_LIMITS; | 2537 load_flags |= net::LOAD_IGNORE_LIMITS; |
| 2536 | 2538 |
| 2537 return load_flags; | 2539 return load_flags; |
| 2538 } | 2540 } |
| 2539 | 2541 |
| 2540 } // namespace content | 2542 } // namespace content |
| OLD | NEW |