| 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 #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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 268 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 269 base::Bind(&UpdateContentLengthPrefs, | 269 base::Bind(&UpdateContentLengthPrefs, |
| 270 received_content_length, original_content_length, | 270 received_content_length, original_content_length, |
| 271 request_type, profile)); | 271 request_type, profile)); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void RecordContentLengthHistograms( | 274 void RecordContentLengthHistograms( |
| 275 int64 received_content_length, | 275 int64 received_content_length, |
| 276 int64 original_content_length, | 276 int64 original_content_length, |
| 277 const base::TimeDelta& freshness_lifetime) { | 277 const base::TimeDelta& freshness_lifetime) { |
| 278 #if defined(OS_ANDROID) | |
| 279 // Add the current resource to these histograms only when a valid | 278 // Add the current resource to these histograms only when a valid |
| 280 // X-Original-Content-Length header is present. | 279 // X-Original-Content-Length header is present. |
| 281 if (original_content_length >= 0) { | 280 if (original_content_length >= 0) { |
| 282 UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthWithValidOCL", | 281 UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthWithValidOCL", |
| 283 received_content_length); | 282 received_content_length); |
| 284 UMA_HISTOGRAM_COUNTS("Net.HttpOriginalContentLengthWithValidOCL", | 283 UMA_HISTOGRAM_COUNTS("Net.HttpOriginalContentLengthWithValidOCL", |
| 285 original_content_length); | 284 original_content_length); |
| 286 UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthDifferenceWithValidOCL", | 285 UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthDifferenceWithValidOCL", |
| 287 original_content_length - received_content_length); | 286 original_content_length - received_content_length); |
| 288 } else { | 287 } else { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 306 received_content_length); | 305 received_content_length); |
| 307 if (freshness_lifetime.InHours() < 4) | 306 if (freshness_lifetime.InHours() < 4) |
| 308 return; | 307 return; |
| 309 UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthCacheable4Hours", | 308 UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthCacheable4Hours", |
| 310 received_content_length); | 309 received_content_length); |
| 311 | 310 |
| 312 if (freshness_lifetime.InHours() < 24) | 311 if (freshness_lifetime.InHours() < 24) |
| 313 return; | 312 return; |
| 314 UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthCacheable24Hours", | 313 UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthCacheable24Hours", |
| 315 received_content_length); | 314 received_content_length); |
| 316 #endif // defined(OS_ANDROID) | |
| 317 } | 315 } |
| 318 | 316 |
| 319 #if defined(OS_ANDROID) | 317 #if defined(OS_ANDROID) |
| 320 void RecordPrecacheStatsOnUIThread(const GURL& url, | 318 void RecordPrecacheStatsOnUIThread(const GURL& url, |
| 321 const base::Time& fetch_time, int64 size, | 319 const base::Time& fetch_time, int64 size, |
| 322 bool was_cached, void* profile_id) { | 320 bool was_cached, void* profile_id) { |
| 323 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 321 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 324 | 322 |
| 325 Profile* profile = reinterpret_cast<Profile*>(profile_id); | 323 Profile* profile = reinterpret_cast<Profile*>(profile_id); |
| 326 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) { | 324 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) { |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 data_reduction_proxy::DataReductionProxyRequestType request_type) { | 860 data_reduction_proxy::DataReductionProxyRequestType request_type) { |
| 863 DCHECK_GE(received_content_length, 0); | 861 DCHECK_GE(received_content_length, 0); |
| 864 DCHECK_GE(original_content_length, 0); | 862 DCHECK_GE(original_content_length, 0); |
| 865 StoreAccumulatedContentLength(received_content_length, | 863 StoreAccumulatedContentLength(received_content_length, |
| 866 original_content_length, | 864 original_content_length, |
| 867 request_type, | 865 request_type, |
| 868 reinterpret_cast<Profile*>(profile_)); | 866 reinterpret_cast<Profile*>(profile_)); |
| 869 received_content_length_ += received_content_length; | 867 received_content_length_ += received_content_length; |
| 870 original_content_length_ += original_content_length; | 868 original_content_length_ += original_content_length; |
| 871 } | 869 } |
| OLD | NEW |