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

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

Issue 1993083002: The cross-origin checks in the multibuffer code are not sufficient, as they only trigger when a red… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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
« no previous file with comments | « media/blink/resource_multibuffer_data_provider_unittest.cc ('k') | media/blink/url_index.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 size_t CachedSize(); 90 size_t CachedSize();
91 91
92 // Returns our url_index, or nullptr if it's been destroyed. 92 // Returns our url_index, or nullptr if it's been destroyed.
93 UrlIndex* url_index() const { return url_index_.get(); } 93 UrlIndex* url_index() const { return url_index_.get(); }
94 94
95 // Notifies the url index that this is currently used. 95 // Notifies the url index that this is currently used.
96 // The url <-> URLData mapping will be eventually be invalidated if 96 // The url <-> URLData mapping will be eventually be invalidated if
97 // this is not called regularly. 97 // this is not called regularly.
98 void Use(); 98 void Use();
99 99
100 // Call this before we add some data to the multibuffer().
101 // If the multibuffer is empty, the data origin is set from
102 // |origin| and returns true. If not, it compares |origin|
103 // to the previous origin and returns wheather they match or not.
104 bool ValidateDataOrigin(const GURL& origin);
105
100 // Setters. 106 // Setters.
101 void set_length(int64_t length); 107 void set_length(int64_t length);
102 void set_cacheable(bool cacheable); 108 void set_cacheable(bool cacheable);
103 void set_valid_until(base::Time valid_until); 109 void set_valid_until(base::Time valid_until);
104 void set_range_supported(); 110 void set_range_supported();
105 void set_last_modified(base::Time last_modified); 111 void set_last_modified(base::Time last_modified);
106 112
107 // A redirect has occured (or we've found a better UrlData for the same 113 // A redirect has occured (or we've found a better UrlData for the same
108 // resource). 114 // resource).
109 void RedirectTo(const scoped_refptr<UrlData>& to); 115 void RedirectTo(const scoped_refptr<UrlData>& to);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 friend class UrlIndex; 147 friend class UrlIndex;
142 friend class base::RefCounted<UrlData>; 148 friend class base::RefCounted<UrlData>;
143 149
144 void OnEmpty(); 150 void OnEmpty();
145 void MergeFrom(const scoped_refptr<UrlData>& other); 151 void MergeFrom(const scoped_refptr<UrlData>& other);
146 152
147 // Url we represent, note that there may be multiple UrlData for 153 // Url we represent, note that there may be multiple UrlData for
148 // the same url. 154 // the same url.
149 const GURL url_; 155 const GURL url_;
150 156
157 // Origin of the data, should only be different from the url_.GetOrigin()
158 // when service workers are involved.
159 GURL data_origin_;
160 bool have_data_origin_;
161
151 // Cross-origin access mode. 162 // Cross-origin access mode.
152 const CORSMode cors_mode_; 163 const CORSMode cors_mode_;
153 164
154 base::WeakPtr<UrlIndex> url_index_; 165 base::WeakPtr<UrlIndex> url_index_;
155 166
156 // Length of resource this url points to. (in bytes) 167 // Length of resource this url points to. (in bytes)
157 int64_t length_; 168 int64_t length_;
158 169
159 // Does the server support ranges? 170 // Does the server support ranges?
160 bool range_supported_; 171 bool range_supported_;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // log2 of block size in multibuffer cache. Defaults to kBlockSizeShift. 246 // log2 of block size in multibuffer cache. Defaults to kBlockSizeShift.
236 // Currently only changed for testing purposes. 247 // Currently only changed for testing purposes.
237 const int block_shift_; 248 const int block_shift_;
238 249
239 protected: 250 protected:
240 base::WeakPtrFactory<UrlIndex> weak_factory_; 251 base::WeakPtrFactory<UrlIndex> weak_factory_;
241 }; 252 };
242 253
243 } // namespace media 254 } // namespace media
244 #endif // MEDIA_BLINK_URL_INDEX_H_ 255 #endif // MEDIA_BLINK_URL_INDEX_H_
OLDNEW
« no previous file with comments | « media/blink/resource_multibuffer_data_provider_unittest.cc ('k') | media/blink/url_index.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698