| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/blink/buffered_resource_loader.h" | 5 #include "media/blink/buffered_resource_loader.h" |
| 6 | 6 |
| 7 #include "base/bits.h" | 7 #include "base/bits.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 void BufferedResourceLoader::didReceiveResponse( | 356 void BufferedResourceLoader::didReceiveResponse( |
| 357 WebURLLoader* loader, | 357 WebURLLoader* loader, |
| 358 const WebURLResponse& response) { | 358 const WebURLResponse& response) { |
| 359 DVLOG(1) << "didReceiveResponse: HTTP/" | 359 DVLOG(1) << "didReceiveResponse: HTTP/" |
| 360 << (response.httpVersion() == WebURLResponse::HTTP_0_9 ? "0.9" : | 360 << (response.httpVersion() == WebURLResponse::HTTP_0_9 ? "0.9" : |
| 361 response.httpVersion() == WebURLResponse::HTTP_1_0 ? "1.0" : | 361 response.httpVersion() == WebURLResponse::HTTP_1_0 ? "1.0" : |
| 362 response.httpVersion() == WebURLResponse::HTTP_1_1 ? "1.1" : | 362 response.httpVersion() == WebURLResponse::HTTP_1_1 ? "1.1" : |
| 363 "Unknown") | 363 "Unknown") |
| 364 << " " << response.httpStatusCode(); | 364 << " " << response.httpStatusCode(); |
| 365 DCHECK(active_loader_.get()); | 365 DCHECK(active_loader_.get()); |
| 366 response_original_url_ = response.wasFetchedViaServiceWorker() |
| 367 ? response.originalURLViaServiceWorker() |
| 368 : response.url(); |
| 366 | 369 |
| 367 // The loader may have been stopped and |start_cb| is destroyed. | 370 // The loader may have been stopped and |start_cb| is destroyed. |
| 368 // In this case we shouldn't do anything. | 371 // In this case we shouldn't do anything. |
| 369 if (start_cb_.is_null()) | 372 if (start_cb_.is_null()) |
| 370 return; | 373 return; |
| 371 | 374 |
| 372 uint32 reasons = GetReasonsForUncacheability(response); | 375 uint32 reasons = GetReasonsForUncacheability(response); |
| 373 might_be_reused_from_cache_in_future_ = reasons == 0; | 376 might_be_reused_from_cache_in_future_ = reasons == 0; |
| 374 UMA_HISTOGRAM_BOOLEAN("Media.CacheUseful", reasons == 0); | 377 UMA_HISTOGRAM_BOOLEAN("Media.CacheUseful", reasons == 0); |
| 375 int shift = 0; | 378 int shift = 0; |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 | 807 |
| 805 void BufferedResourceLoader::Log() { | 808 void BufferedResourceLoader::Log() { |
| 806 media_log_->AddEvent( | 809 media_log_->AddEvent( |
| 807 media_log_->CreateBufferedExtentsChangedEvent( | 810 media_log_->CreateBufferedExtentsChangedEvent( |
| 808 offset_ - buffer_.backward_bytes(), | 811 offset_ - buffer_.backward_bytes(), |
| 809 offset_, | 812 offset_, |
| 810 offset_ + buffer_.forward_bytes())); | 813 offset_ + buffer_.forward_bytes())); |
| 811 } | 814 } |
| 812 | 815 |
| 813 } // namespace media | 816 } // namespace media |
| OLD | NEW |