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

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

Issue 577963002: Add time-to-network histogram considering browser side navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR comments, added new hisogram, test and fixes. Created 6 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 (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
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
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).
nasko 2014/09/24 00:48:07 nit: Navigator, you don't have any Impls in the co
carlosk 2014/09/24 18:35:50 Done.
336 void LogResourceRequestTimeOnUI(
337 base::TimeTicks timestamp,
338 int render_process_id,
339 int render_frame_host,
nasko 2014/09/24 00:48:07 nit: render_frame_id
carlosk 2014/09/24 18:35:50 Done.
340 const GURL& url) {
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 Navigator* navigator = host->frame_tree_node()->navigator();
nasko 2014/09/24 00:48:07 nit: no real need for a stack variable here.
carlosk 2014/09/24 18:35:50 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
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 BrowserThread::PostTask(
912 BrowserThread::UI,
913 FROM_HERE,
914 base::Bind(&LogResourceRequestTimeOnUI,
915 TimeTicks::Now(),
916 filter_->child_id(),
917 request_data.render_frame_id,
918 request_data.url));
919 }
891 BeginRequest(request_id, request_data, NULL, routing_id); 920 BeginRequest(request_id, request_data, NULL, routing_id);
892 } 921 }
893 922
894 // Begins a resource request with the given params on behalf of the specified 923 // 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 924 // 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 925 // 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 926 // a request from a renderer. request_context is the cookie/cache context to be
898 // used for this request. 927 // used for this request.
899 // 928 //
900 // If sync_result is non-null, then a SyncLoad reply will be generated, else 929 // 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
2049 2078
2050 // Add a flag to selectively bypass the data reduction proxy if the resource 2079 // Add a flag to selectively bypass the data reduction proxy if the resource
2051 // type is not an image. 2080 // type is not an image.
2052 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) 2081 if (request_data.resource_type != RESOURCE_TYPE_IMAGE)
2053 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; 2082 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY;
2054 2083
2055 return load_flags; 2084 return load_flags;
2056 } 2085 }
2057 2086
2058 } // namespace content 2087 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698