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 "webkit/renderer/media/buffered_resource_loader.h" | 5 #include "content/renderer/media/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/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "content/renderer/media/cache_util.h" |
14 #include "media/base/media_log.h" | 15 #include "media/base/media_log.h" |
15 #include "net/http/http_request_headers.h" | 16 #include "net/http/http_request_headers.h" |
16 #include "third_party/WebKit/public/platform/WebString.h" | 17 #include "third_party/WebKit/public/platform/WebString.h" |
17 #include "third_party/WebKit/public/platform/WebURLError.h" | 18 #include "third_party/WebKit/public/platform/WebURLError.h" |
18 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 19 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
19 #include "third_party/WebKit/public/web/WebKit.h" | 20 #include "third_party/WebKit/public/web/WebKit.h" |
20 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h" | 21 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h" |
21 #include "webkit/renderer/media/cache_util.h" | |
22 | 22 |
23 using WebKit::WebFrame; | 23 using WebKit::WebFrame; |
24 using WebKit::WebString; | 24 using WebKit::WebString; |
25 using WebKit::WebURLError; | 25 using WebKit::WebURLError; |
26 using WebKit::WebURLLoader; | 26 using WebKit::WebURLLoader; |
27 using WebKit::WebURLLoaderOptions; | 27 using WebKit::WebURLLoaderOptions; |
28 using WebKit::WebURLRequest; | 28 using WebKit::WebURLRequest; |
29 using WebKit::WebURLResponse; | 29 using WebKit::WebURLResponse; |
30 | 30 |
31 namespace webkit_media { | 31 namespace content { |
32 | 32 |
33 static const int kHttpOK = 200; | 33 static const int kHttpOK = 200; |
34 static const int kHttpPartialContent = 206; | 34 static const int kHttpPartialContent = 206; |
35 | 35 |
36 // Define the number of bytes in a megabyte. | 36 // Define the number of bytes in a megabyte. |
37 static const int kMegabyte = 1024 * 1024; | 37 static const int kMegabyte = 1024 * 1024; |
38 | 38 |
39 // Minimum capacity of the buffer in forward or backward direction. | 39 // Minimum capacity of the buffer in forward or backward direction. |
40 // | 40 // |
41 // 2MB is an arbitrary limit; it just seems to be "good enough" in practice. | 41 // 2MB is an arbitrary limit; it just seems to be "good enough" in practice. |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 } | 793 } |
794 | 794 |
795 void BufferedResourceLoader::Log() { | 795 void BufferedResourceLoader::Log() { |
796 media_log_->AddEvent( | 796 media_log_->AddEvent( |
797 media_log_->CreateBufferedExtentsChangedEvent( | 797 media_log_->CreateBufferedExtentsChangedEvent( |
798 offset_ - buffer_.backward_bytes(), | 798 offset_ - buffer_.backward_bytes(), |
799 offset_, | 799 offset_, |
800 offset_ + buffer_.forward_bytes())); | 800 offset_ + buffer_.forward_bytes())); |
801 } | 801 } |
802 | 802 |
803 } // namespace webkit_media | 803 } // namespace content |
OLD | NEW |