| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef MEDIA_BLINK_URL_INDEX_H_ | 5 #ifndef MEDIA_BLINK_URL_INDEX_H_ |
| 6 #define MEDIA_BLINK_URL_INDEX_H_ | 6 #define MEDIA_BLINK_URL_INDEX_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // A single media player instance may choose to ignore this for resources | 132 // A single media player instance may choose to ignore this for resources |
| 133 // that have already been opened. | 133 // that have already been opened. |
| 134 bool Valid() const; | 134 bool Valid() const; |
| 135 | 135 |
| 136 // Virtual so we can override it for testing. | 136 // Virtual so we can override it for testing. |
| 137 virtual ResourceMultiBuffer* multibuffer(); | 137 virtual ResourceMultiBuffer* multibuffer(); |
| 138 | 138 |
| 139 // Accessor | 139 // Accessor |
| 140 blink::WebFrame* frame() const { return frame_; } | 140 blink::WebFrame* frame() const { return frame_; } |
| 141 | 141 |
| 142 void AddBytesRead(int64_t b) { bytes_read_from_cache_ += b; } |
| 143 int64_t BytesReadFromCache() { return bytes_read_from_cache_; } |
| 144 |
| 142 protected: | 145 protected: |
| 143 UrlData(const GURL& url, | 146 UrlData(const GURL& url, |
| 144 CORSMode cors_mode, | 147 CORSMode cors_mode, |
| 145 const base::WeakPtr<UrlIndex>& url_index); | 148 const base::WeakPtr<UrlIndex>& url_index); |
| 146 virtual ~UrlData(); | 149 virtual ~UrlData(); |
| 147 | 150 |
| 148 private: | 151 private: |
| 149 friend class ResourceMultiBuffer; | 152 friend class ResourceMultiBuffer; |
| 150 friend class UrlIndex; | 153 friend class UrlIndex; |
| 151 friend class base::RefCounted<UrlData>; | 154 friend class base::RefCounted<UrlData>; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 163 bool have_data_origin_; | 166 bool have_data_origin_; |
| 164 | 167 |
| 165 // Cross-origin access mode. | 168 // Cross-origin access mode. |
| 166 const CORSMode cors_mode_; | 169 const CORSMode cors_mode_; |
| 167 | 170 |
| 168 base::WeakPtr<UrlIndex> url_index_; | 171 base::WeakPtr<UrlIndex> url_index_; |
| 169 | 172 |
| 170 // Length of resource this url points to. (in bytes) | 173 // Length of resource this url points to. (in bytes) |
| 171 int64_t length_; | 174 int64_t length_; |
| 172 | 175 |
| 176 // Number of bytes read from this resource. |
| 177 int64_t bytes_read_from_cache_ = 0; |
| 178 |
| 173 // Does the server support ranges? | 179 // Does the server support ranges? |
| 174 bool range_supported_; | 180 bool range_supported_; |
| 175 | 181 |
| 176 // Set to false if we have reason to beleive the chrome disk cache | 182 // Set to false if we have reason to beleive the chrome disk cache |
| 177 // will not cache this url. | 183 // will not cache this url. |
| 178 bool cacheable_; | 184 bool cacheable_; |
| 179 | 185 |
| 180 // Last time some media time used this resource. | 186 // Last time some media time used this resource. |
| 181 // Note that we use base::Time rather than base::TimeTicks because | 187 // Note that we use base::Time rather than base::TimeTicks because |
| 182 // TimeTicks will stop advancing when a machine goes to sleep. | 188 // TimeTicks will stop advancing when a machine goes to sleep. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // log2 of block size in multibuffer cache. Defaults to kBlockSizeShift. | 258 // log2 of block size in multibuffer cache. Defaults to kBlockSizeShift. |
| 253 // Currently only changed for testing purposes. | 259 // Currently only changed for testing purposes. |
| 254 const int block_shift_; | 260 const int block_shift_; |
| 255 | 261 |
| 256 protected: | 262 protected: |
| 257 base::WeakPtrFactory<UrlIndex> weak_factory_; | 263 base::WeakPtrFactory<UrlIndex> weak_factory_; |
| 258 }; | 264 }; |
| 259 | 265 |
| 260 } // namespace media | 266 } // namespace media |
| 261 #endif // MEDIA_BLINK_URL_INDEX_H_ | 267 #endif // MEDIA_BLINK_URL_INDEX_H_ |
| OLD | NEW |