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 NavigatorImpl (for an UMA histogram). | |
| 336 void LogResourceRequestTimeOnUI( | |
| 337 base::TimeTicks timestamp, | |
| 338 int render_process_id, | |
| 339 int render_frame_host, | |
| 340 GURL url) { | |
|
davidben
2014/09/19 21:52:45
Nit: const GURL& url
carlosk
2014/09/23 17:02:57
Done.
| |
| 341 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 342 RenderFrameHostImpl* host = | |
| 343 RenderFrameHostImpl::FromID(render_process_id, render_frame_host); | |
| 344 if (host != NULL) { | |
| 345 DCHECK(host->frame_tree_node()->IsMainFrame()); | |
| 346 content::Navigator* navigator = host->frame_tree_node()->navigator(); | |
|
clamy
2014/09/19 14:56:03
content:: is unnecessary here.
carlosk
2014/09/23 17:02:57
Done.
| |
| 347 navigator->LogResourceRequestTime(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 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) { | |
| 911 int child_id = filter_->child_id(); | |
|
clamy
2014/09/19 14:56:03
nit: you could just write filter_->child_id() in t
carlosk
2014/09/23 17:02:57
Done.
| |
| 912 BrowserThread::PostTask( | |
| 913 BrowserThread::UI, | |
| 914 FROM_HERE, | |
| 915 base::Bind(&LogResourceRequestTimeOnUI, | |
| 916 TimeTicks::Now(), | |
|
davidben
2014/09/19 21:52:45
A thought: net/ maintains a net::LoadTimingInfo wh
carlosk
2014/09/23 17:02:57
As discussed in yesterday's hangout I'll use this
clamy
2014/09/23 21:54:07
As mentioned in the bug, this is problematic as ht
| |
| 917 child_id, | |
| 918 request_data.render_frame_id, | |
| 919 request_data.url)); | |
| 920 } | |
| 891 BeginRequest(request_id, request_data, NULL, routing_id); | 921 BeginRequest(request_id, request_data, NULL, routing_id); |
| 892 } | 922 } |
| 893 | 923 |
| 894 // Begins a resource request with the given params on behalf of the specified | 924 // 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 | 925 // 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 | 926 // 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 | 927 // a request from a renderer. request_context is the cookie/cache context to be |
| 898 // used for this request. | 928 // used for this request. |
| 899 // | 929 // |
| 900 // If sync_result is non-null, then a SyncLoad reply will be generated, else | 930 // 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 | 2079 |
| 2050 // Add a flag to selectively bypass the data reduction proxy if the resource | 2080 // Add a flag to selectively bypass the data reduction proxy if the resource |
| 2051 // type is not an image. | 2081 // type is not an image. |
| 2052 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2082 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
| 2053 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2083 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
| 2054 | 2084 |
| 2055 return load_flags; | 2085 return load_flags; |
| 2056 } | 2086 } |
| 2057 | 2087 |
| 2058 } // namespace content | 2088 } // namespace content |
| OLD | NEW |