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

Side by Side Diff: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc

Issue 2748053004: [Offline Pages] Allow BackgroundLoader to track network bytes using prerenderer hook-in. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" 5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 #endif 100 #endif
101 101
102 #if defined(USE_SYSTEM_PROTOBUF) 102 #if defined(USE_SYSTEM_PROTOBUF)
103 #include <google/protobuf/repeated_field.h> 103 #include <google/protobuf/repeated_field.h>
104 #else 104 #else
105 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" 105 #include "third_party/protobuf/src/google/protobuf/repeated_field.h"
106 #endif 106 #endif
107 107
108 #if defined(OS_ANDROID) 108 #if defined(OS_ANDROID)
109 #include "chrome/browser/android/download/intercept_download_resource_throttle.h " 109 #include "chrome/browser/android/download/intercept_download_resource_throttle.h "
110 #include "chrome/browser/android/offline_pages/background_loader_offliner.h"
110 #include "chrome/browser/android/offline_pages/downloads/resource_throttle.h" 111 #include "chrome/browser/android/offline_pages/downloads/resource_throttle.h"
111 #include "chrome/browser/loader/data_reduction_proxy_resource_throttle_android.h " 112 #include "chrome/browser/loader/data_reduction_proxy_resource_throttle_android.h "
112 #include "components/navigation_interception/intercept_navigation_delegate.h" 113 #include "components/navigation_interception/intercept_navigation_delegate.h"
113 #endif 114 #endif
114 115
115 #if defined(OS_CHROMEOS) 116 #if defined(OS_CHROMEOS)
116 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h " 117 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h "
117 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" 118 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h"
118 #endif 119 #endif
119 120
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 base::TimeTicks request_creation_time, 366 base::TimeTicks request_creation_time,
366 base::TimeDelta request_loading_time) { 367 base::TimeDelta request_loading_time) {
367 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 368 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
368 content::WebContents* web_contents = web_contents_getter.Run(); 369 content::WebContents* web_contents = web_contents_getter.Run();
369 if (!web_contents) 370 if (!web_contents)
370 return; 371 return;
371 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { 372 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) {
372 LogMainFrameMetricsOnUIThread(url, net_error, request_loading_time, 373 LogMainFrameMetricsOnUIThread(url, net_error, request_loading_time,
373 web_contents); 374 web_contents);
374 } 375 }
375 if (!was_cached) 376 if (!was_cached) {
376 UpdatePrerenderNetworkBytesCallback(web_contents, total_received_bytes); 377 UpdatePrerenderNetworkBytesCallback(web_contents, total_received_bytes);
378 #if defined(OS_ANDROID)
379 offline_pages::BackgroundLoaderOffliner* background_loader =
380 offline_pages::BackgroundLoaderOffliner::FromWebContents(web_contents);
381
382 if (background_loader)
383 background_loader->OnNetworkBytesChanged(total_received_bytes);
384 #endif // OS_ANDROID
385 }
377 page_load_metrics::MetricsWebContentsObserver* metrics_observer = 386 page_load_metrics::MetricsWebContentsObserver* metrics_observer =
378 page_load_metrics::MetricsWebContentsObserver::FromWebContents( 387 page_load_metrics::MetricsWebContentsObserver::FromWebContents(
379 web_contents); 388 web_contents);
380 if (metrics_observer) { 389 if (metrics_observer) {
381 metrics_observer->OnRequestComplete( 390 metrics_observer->OnRequestComplete(
382 request_id, resource_type, was_cached, used_data_reduction_proxy, 391 request_id, resource_type, was_cached, used_data_reduction_proxy,
383 raw_body_bytes, original_content_length, request_creation_time); 392 raw_body_bytes, original_content_length, request_creation_time);
384 } 393 }
385 } 394 }
386 395
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 934 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
926 base::Unretained(this), url, request_loading_time)); 935 base::Unretained(this), url, request_loading_time));
927 return; 936 return;
928 } 937 }
929 938
930 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 939 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
931 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 940 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
932 rappor::SampleDomainAndRegistryFromGURL( 941 rappor::SampleDomainAndRegistryFromGURL(
933 g_browser_process->rappor_service(), metric_name, url); 942 g_browser_process->rappor_service(), metric_name, url);
934 } 943 }
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698