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 14 matching lines...) Expand all Loading... | |
| 25 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 25 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 26 #include "content/browser/appcache/appcache_interceptor.h" | 26 #include "content/browser/appcache/appcache_interceptor.h" |
| 27 #include "content/browser/appcache/chrome_appcache_service.h" | 27 #include "content/browser/appcache/chrome_appcache_service.h" |
| 28 #include "content/browser/cert_store_impl.h" | 28 #include "content/browser/cert_store_impl.h" |
| 29 #include "content/browser/child_process_security_policy_impl.h" | 29 #include "content/browser/child_process_security_policy_impl.h" |
| 30 #include "content/browser/download/download_resource_handler.h" | 30 #include "content/browser/download/download_resource_handler.h" |
| 31 #include "content/browser/download/save_file_manager.h" | 31 #include "content/browser/download/save_file_manager.h" |
| 32 #include "content/browser/download/save_file_resource_handler.h" | 32 #include "content/browser/download/save_file_resource_handler.h" |
| 33 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 33 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| 34 #include "content/browser/frame_host/navigation_request_info.h" | 34 #include "content/browser/frame_host/navigation_request_info.h" |
| 35 #include "content/browser/frame_host/navigator.h" | |
| 35 #include "content/browser/loader/async_resource_handler.h" | 36 #include "content/browser/loader/async_resource_handler.h" |
| 36 #include "content/browser/loader/buffered_resource_handler.h" | 37 #include "content/browser/loader/buffered_resource_handler.h" |
| 37 #include "content/browser/loader/cross_site_resource_handler.h" | 38 #include "content/browser/loader/cross_site_resource_handler.h" |
| 38 #include "content/browser/loader/detachable_resource_handler.h" | 39 #include "content/browser/loader/detachable_resource_handler.h" |
| 39 #include "content/browser/loader/power_save_block_resource_throttle.h" | 40 #include "content/browser/loader/power_save_block_resource_throttle.h" |
| 40 #include "content/browser/loader/redirect_to_file_resource_handler.h" | 41 #include "content/browser/loader/redirect_to_file_resource_handler.h" |
| 41 #include "content/browser/loader/resource_message_filter.h" | 42 #include "content/browser/loader/resource_message_filter.h" |
| 42 #include "content/browser/loader/resource_request_info_impl.h" | 43 #include "content/browser/loader/resource_request_info_impl.h" |
| 43 #include "content/browser/loader/stream_resource_handler.h" | 44 #include "content/browser/loader/stream_resource_handler.h" |
| 44 #include "content/browser/loader/sync_resource_handler.h" | 45 #include "content/browser/loader/sync_resource_handler.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 DCHECK(handle); | 323 DCHECK(handle); |
| 323 if (!handle) | 324 if (!handle) |
| 324 continue; | 325 continue; |
| 325 // Ensure the blob and any attached shareable files survive until | 326 // Ensure the blob and any attached shareable files survive until |
| 326 // upload completion. The |body| takes ownership of |handle|. | 327 // upload completion. The |body| takes ownership of |handle|. |
| 327 const void* key = handle.get(); | 328 const void* key = handle.get(); |
| 328 body->SetUserData(key, handle.release()); | 329 body->SetUserData(key, handle.release()); |
| 329 } | 330 } |
| 330 } | 331 } |
| 331 | 332 |
| 333 // PlzNavigate | |
| 334 // This method is called in the UI thread to send the timestamp of a resource | |
| 335 // request to the respective Navigator (for an UMA histogram). | |
| 336 void LogResourceRequestTimeOnUI( | |
| 337 base::TimeTicks timestamp, | |
| 338 int render_process_id, | |
| 339 int render_frame_id, | |
| 340 const GURL& url) { | |
| 341 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 342 RenderFrameHostImpl* host = | |
| 343 RenderFrameHostImpl::FromID(render_process_id, render_frame_id); | |
| 344 if (host != NULL) { | |
| 345 DCHECK(host->frame_tree_node()->IsMainFrame()); | |
| 346 host->frame_tree_node()->navigator()->LogResourceRequestTime( | |
| 347 timestamp, url); | |
| 348 } | |
| 349 } | |
| 350 | |
| 332 } // namespace | 351 } // namespace |
| 333 | 352 |
| 334 // static | 353 // static |
| 335 ResourceDispatcherHost* ResourceDispatcherHost::Get() { | 354 ResourceDispatcherHost* ResourceDispatcherHost::Get() { |
| 336 return g_resource_dispatcher_host; | 355 return g_resource_dispatcher_host; |
| 337 } | 356 } |
| 338 | 357 |
| 339 ResourceDispatcherHostImpl::ResourceDispatcherHostImpl() | 358 ResourceDispatcherHostImpl::ResourceDispatcherHostImpl() |
| 340 : save_file_manager_(new SaveFileManager()), | 359 : save_file_manager_(new SaveFileManager()), |
| 341 request_id_(-1), | 360 request_id_(-1), |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 881 } | 900 } |
| 882 | 901 |
| 883 filter_ = NULL; | 902 filter_ = NULL; |
| 884 return handled; | 903 return handled; |
| 885 } | 904 } |
| 886 | 905 |
| 887 void ResourceDispatcherHostImpl::OnRequestResource( | 906 void ResourceDispatcherHostImpl::OnRequestResource( |
| 888 int routing_id, | 907 int routing_id, |
| 889 int request_id, | 908 int request_id, |
| 890 const ResourceHostMsg_Request& request_data) { | 909 const ResourceHostMsg_Request& request_data) { |
| 910 // When logging time-to-network only cares about main frame and non-transfer | |
|
nasko
2014/09/26 00:10:35
nit: s/cares/care/
Why do we not care about transf
clamy
2014/09/26 14:48:32
I think we only want the first request for transfe
carlosk
2014/09/26 15:50:25
Done.
From my understanding of what we're trackin
nasko
2014/09/26 17:34:18
Acknowledged.
| |
| 911 // navigations. | |
| 912 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME && | |
| 913 request_data.transferred_request_request_id == -1) { | |
|
davidben
2014/09/26 15:42:45
Aside: There's a slight weirdness that this'll act
carlosk
2014/09/26 15:52:17
Acknowledged.
| |
| 914 BrowserThread::PostTask( | |
| 915 BrowserThread::UI, | |
| 916 FROM_HERE, | |
| 917 base::Bind(&LogResourceRequestTimeOnUI, | |
| 918 TimeTicks::Now(), | |
| 919 filter_->child_id(), | |
| 920 request_data.render_frame_id, | |
| 921 request_data.url)); | |
| 922 } | |
| 891 BeginRequest(request_id, request_data, NULL, routing_id); | 923 BeginRequest(request_id, request_data, NULL, routing_id); |
| 892 } | 924 } |
| 893 | 925 |
| 894 // Begins a resource request with the given params on behalf of the specified | 926 // Begins a resource request with the given params on behalf of the specified |
| 895 // child process. Responses will be dispatched through the given receiver. The | 927 // child process. Responses will be dispatched through the given receiver. The |
| 896 // process ID is used to lookup WebContentsImpl from routing_id's in the case of | 928 // process ID is used to lookup WebContentsImpl from routing_id's in the case of |
| 897 // a request from a renderer. request_context is the cookie/cache context to be | 929 // a request from a renderer. request_context is the cookie/cache context to be |
| 898 // used for this request. | 930 // used for this request. |
| 899 // | 931 // |
| 900 // If sync_result is non-null, then a SyncLoad reply will be generated, else | 932 // If sync_result is non-null, then a SyncLoad reply will be generated, else |
| (...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2049 | 2081 |
| 2050 // Add a flag to selectively bypass the data reduction proxy if the resource | 2082 // Add a flag to selectively bypass the data reduction proxy if the resource |
| 2051 // type is not an image. | 2083 // type is not an image. |
| 2052 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2084 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
| 2053 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2085 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
| 2054 | 2086 |
| 2055 return load_flags; | 2087 return load_flags; |
| 2056 } | 2088 } |
| 2057 | 2089 |
| 2058 } // namespace content | 2090 } // namespace content |
| OLD | NEW |