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

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 514353002: Check if precaching is allowed before reporting related metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | components/precache/content/DEPS » ('j') | 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/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 bool was_cached, void* profile_id) { 210 bool was_cached, void* profile_id) {
211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
212 212
213 Profile* profile = reinterpret_cast<Profile*>(profile_id); 213 Profile* profile = reinterpret_cast<Profile*>(profile_id);
214 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) { 214 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) {
215 return; 215 return;
216 } 216 }
217 217
218 precache::PrecacheManager* precache_manager = 218 precache::PrecacheManager* precache_manager =
219 precache::PrecacheManagerFactory::GetForBrowserContext(profile); 219 precache::PrecacheManagerFactory::GetForBrowserContext(profile);
220 if (!precache_manager) { 220 if (!precache_manager || !precache_manager->IsPrecachingAllowed()) {
221 // This could be NULL if the profile is off the record. 221 // |precache_manager| could be NULL if the profile is off the record.
222 return; 222 return;
223 } 223 }
224 224
225 precache_manager->RecordStatsForFetch(url, fetch_time, size, was_cached); 225 precache_manager->RecordStatsForFetch(url, fetch_time, size, was_cached);
226 } 226 }
227 227
228 void RecordIOThreadToRequestStartOnUIThread( 228 void RecordIOThreadToRequestStartOnUIThread(
229 const base::TimeTicks& request_start) { 229 const base::TimeTicks& request_start) {
230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
231 base::TimeDelta request_lag = request_start - 231 base::TimeDelta request_lag = request_start -
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 data_reduction_proxy::DataReductionProxyRequestType request_type) { 817 data_reduction_proxy::DataReductionProxyRequestType request_type) {
818 DCHECK_GE(received_content_length, 0); 818 DCHECK_GE(received_content_length, 0);
819 DCHECK_GE(original_content_length, 0); 819 DCHECK_GE(original_content_length, 0);
820 StoreAccumulatedContentLength(received_content_length, 820 StoreAccumulatedContentLength(received_content_length,
821 original_content_length, 821 original_content_length,
822 request_type, 822 request_type,
823 reinterpret_cast<Profile*>(profile_)); 823 reinterpret_cast<Profile*>(profile_));
824 received_content_length_ += received_content_length; 824 received_content_length_ += received_content_length;
825 original_content_length_ += original_content_length; 825 original_content_length_ += original_content_length;
826 } 826 }
OLDNEW
« no previous file with comments | « no previous file | components/precache/content/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698