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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // that have already been opened. | 136 // that have already been opened. |
137 bool Valid(); | 137 bool Valid(); |
138 | 138 |
139 // Virtual so we can override it for testing. | 139 // Virtual so we can override it for testing. |
140 virtual ResourceMultiBuffer* multibuffer(); | 140 virtual ResourceMultiBuffer* multibuffer(); |
141 | 141 |
142 // Accessor | 142 // Accessor |
143 blink::WebLocalFrame* frame() const { return frame_; } | 143 blink::WebLocalFrame* frame() const { return frame_; } |
144 | 144 |
145 void AddBytesRead(int64_t b) { bytes_read_from_cache_ += b; } | 145 void AddBytesRead(int64_t b) { bytes_read_from_cache_ += b; } |
146 int64_t BytesReadFromCache() { return bytes_read_from_cache_; } | 146 int64_t BytesReadFromCache() const { return bytes_read_from_cache_; } |
| 147 void AddBytesReadFromNetwork(int64_t b) { bytes_read_from_network_ += b; } |
| 148 int64_t BytesReadFromNetwork() const { return bytes_read_from_network_; } |
147 | 149 |
148 protected: | 150 protected: |
149 UrlData(const GURL& url, | 151 UrlData(const GURL& url, |
150 CORSMode cors_mode, | 152 CORSMode cors_mode, |
151 const base::WeakPtr<UrlIndex>& url_index); | 153 const base::WeakPtr<UrlIndex>& url_index); |
152 virtual ~UrlData(); | 154 virtual ~UrlData(); |
153 | 155 |
154 private: | 156 private: |
155 friend class ResourceMultiBuffer; | 157 friend class ResourceMultiBuffer; |
156 friend class UrlIndex; | 158 friend class UrlIndex; |
(...skipping 15 matching lines...) Expand all Loading... |
172 const CORSMode cors_mode_; | 174 const CORSMode cors_mode_; |
173 | 175 |
174 base::WeakPtr<UrlIndex> url_index_; | 176 base::WeakPtr<UrlIndex> url_index_; |
175 | 177 |
176 // Length of resource this url points to. (in bytes) | 178 // Length of resource this url points to. (in bytes) |
177 int64_t length_; | 179 int64_t length_; |
178 | 180 |
179 // Number of bytes read from this resource. | 181 // Number of bytes read from this resource. |
180 int64_t bytes_read_from_cache_ = 0; | 182 int64_t bytes_read_from_cache_ = 0; |
181 | 183 |
| 184 // Number of bytes read from network into the cache for this resource. |
| 185 int64_t bytes_read_from_network_ = 0; |
| 186 |
182 // Does the server support ranges? | 187 // Does the server support ranges? |
183 bool range_supported_; | 188 bool range_supported_; |
184 | 189 |
185 // Set to false if we have reason to beleive the chrome disk cache | 190 // Set to false if we have reason to beleive the chrome disk cache |
186 // will not cache this url. | 191 // will not cache this url. |
187 bool cacheable_; | 192 bool cacheable_; |
188 | 193 |
189 // Last time some media time used this resource. | 194 // Last time some media time used this resource. |
190 // Note that we use base::Time rather than base::TimeTicks because | 195 // Note that we use base::Time rather than base::TimeTicks because |
191 // TimeTicks will stop advancing when a machine goes to sleep. | 196 // TimeTicks will stop advancing when a machine goes to sleep. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // log2 of block size in multibuffer cache. Defaults to kBlockSizeShift. | 266 // log2 of block size in multibuffer cache. Defaults to kBlockSizeShift. |
262 // Currently only changed for testing purposes. | 267 // Currently only changed for testing purposes. |
263 const int block_shift_; | 268 const int block_shift_; |
264 | 269 |
265 protected: | 270 protected: |
266 base::WeakPtrFactory<UrlIndex> weak_factory_; | 271 base::WeakPtrFactory<UrlIndex> weak_factory_; |
267 }; | 272 }; |
268 | 273 |
269 } // namespace media | 274 } // namespace media |
270 #endif // MEDIA_BLINK_URL_INDEX_H_ | 275 #endif // MEDIA_BLINK_URL_INDEX_H_ |
OLD | NEW |