Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: media/blink/url_index.h

Issue 2338963002: Store, use and send etags. (Closed)
Patch Set: comments addressed Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // True if we found a reason why this URL won't be stored in the 70 // True if we found a reason why this URL won't be stored in the
71 // HTTP disk cache. 71 // HTTP disk cache.
72 bool cacheable() const { return cacheable_; } 72 bool cacheable() const { return cacheable_; }
73 73
74 // Last used time. 74 // Last used time.
75 base::Time last_used() const { return last_used_; } 75 base::Time last_used() const { return last_used_; }
76 76
77 // Last modified time. 77 // Last modified time.
78 base::Time last_modified() const { return last_modified_; } 78 base::Time last_modified() const { return last_modified_; }
79 79
80 const std::string& etag() const { return etag_; }
81
80 // Expiration time. 82 // Expiration time.
81 base::Time valid_until() const { return valid_until_; } 83 base::Time valid_until() const { return valid_until_; }
82 84
83 // The key used by UrlIndex to find this UrlData. 85 // The key used by UrlIndex to find this UrlData.
84 KeyType key() const; 86 KeyType key() const;
85 87
86 // Length of data associated with url or |kPositionNotSpecified| 88 // Length of data associated with url or |kPositionNotSpecified|
87 int64_t length() const { return length_; } 89 int64_t length() const { return length_; }
88 90
89 // Returns the number of blocks cached for this resource. 91 // Returns the number of blocks cached for this resource.
(...skipping 12 matching lines...) Expand all
102 // |origin| and returns true. If not, it compares |origin| 104 // |origin| and returns true. If not, it compares |origin|
103 // to the previous origin and returns wheather they match or not. 105 // to the previous origin and returns wheather they match or not.
104 bool ValidateDataOrigin(const GURL& origin); 106 bool ValidateDataOrigin(const GURL& origin);
105 107
106 // Setters. 108 // Setters.
107 void set_length(int64_t length); 109 void set_length(int64_t length);
108 void set_cacheable(bool cacheable); 110 void set_cacheable(bool cacheable);
109 void set_valid_until(base::Time valid_until); 111 void set_valid_until(base::Time valid_until);
110 void set_range_supported(); 112 void set_range_supported();
111 void set_last_modified(base::Time last_modified); 113 void set_last_modified(base::Time last_modified);
114 void set_etag(const std::string& etag);
112 115
113 // A redirect has occured (or we've found a better UrlData for the same 116 // A redirect has occured (or we've found a better UrlData for the same
114 // resource). 117 // resource).
115 void RedirectTo(const scoped_refptr<UrlData>& to); 118 void RedirectTo(const scoped_refptr<UrlData>& to);
116 119
117 // Fail, tell all clients that a failure has occured. 120 // Fail, tell all clients that a failure has occured.
118 void Fail(); 121 void Fail();
119 122
120 // Callback for receving notifications when a redirect occurs. 123 // Callback for receving notifications when a redirect occurs.
121 typedef base::Callback<void(const scoped_refptr<UrlData>&)> RedirectCB; 124 typedef base::Callback<void(const scoped_refptr<UrlData>&)> RedirectCB;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // unpredictable, but it doesn't stop, which is preferable here. 184 // unpredictable, but it doesn't stop, which is preferable here.
182 // (False negatives are better than false positivies.) 185 // (False negatives are better than false positivies.)
183 base::Time last_used_; 186 base::Time last_used_;
184 187
185 // Expiration time according to http headers. 188 // Expiration time according to http headers.
186 base::Time valid_until_; 189 base::Time valid_until_;
187 190
188 // Last modification time according to http headers. 191 // Last modification time according to http headers.
189 base::Time last_modified_; 192 base::Time last_modified_;
190 193
194 // Etag from HTTP reply.
195 std::string etag_;
196
191 ResourceMultiBuffer multibuffer_; 197 ResourceMultiBuffer multibuffer_;
192 std::vector<RedirectCB> redirect_callbacks_; 198 std::vector<RedirectCB> redirect_callbacks_;
193 199
194 blink::WebFrame* frame_; 200 blink::WebFrame* frame_;
195 201
196 base::ThreadChecker thread_checker_; 202 base::ThreadChecker thread_checker_;
197 DISALLOW_COPY_AND_ASSIGN(UrlData); 203 DISALLOW_COPY_AND_ASSIGN(UrlData);
198 }; 204 };
199 205
200 // The UrlIndex lets you look up UrlData instances by url. 206 // The UrlIndex lets you look up UrlData instances by url.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // log2 of block size in multibuffer cache. Defaults to kBlockSizeShift. 252 // log2 of block size in multibuffer cache. Defaults to kBlockSizeShift.
247 // Currently only changed for testing purposes. 253 // Currently only changed for testing purposes.
248 const int block_shift_; 254 const int block_shift_;
249 255
250 protected: 256 protected:
251 base::WeakPtrFactory<UrlIndex> weak_factory_; 257 base::WeakPtrFactory<UrlIndex> weak_factory_;
252 }; 258 };
253 259
254 } // namespace media 260 } // namespace media
255 #endif // MEDIA_BLINK_URL_INDEX_H_ 261 #endif // MEDIA_BLINK_URL_INDEX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698