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

Side by Side Diff: third_party/WebKit/Source/platform/blob/BlobData.h

Issue 2717583003: [BlobStorage] Enforcing renderer constraints to prevent broken blobs (Closed)
Patch Set: moving to dchecks Created 3 years, 9 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 long long offset, 178 long long offset,
179 long long length, 179 long long length,
180 double expectedModificationTime); 180 double expectedModificationTime);
181 void appendText(const String&, bool normalizeLineEndingsToNative); 181 void appendText(const String&, bool normalizeLineEndingsToNative);
182 182
183 // The value of the size property for a Blob who has this data. 183 // The value of the size property for a Blob who has this data.
184 // BlobDataItem::toEndOfFile if the Blob has a file whose size was not yet 184 // BlobDataItem::toEndOfFile if the Blob has a file whose size was not yet
185 // determined. 185 // determined.
186 long long length() const; 186 long long length() const;
187 187
188 bool isSingleUnknownSizeFile() const {
189 return m_fileComposition == FileCompositionStatus::SINGLE_UNKNOWN_SIZE_FILE;
190 }
191
188 private: 192 private:
189 FRIEND_TEST_ALL_PREFIXES(BlobDataTest, Consolidation); 193 FRIEND_TEST_ALL_PREFIXES(BlobDataTest, Consolidation);
190 194
191 enum class FileCompositionStatus { 195 enum class FileCompositionStatus {
192 SINGLE_UNKNOWN_SIZE_FILE, 196 SINGLE_UNKNOWN_SIZE_FILE,
193 NO_UNKNOWN_SIZE_FILES 197 NO_UNKNOWN_SIZE_FILES
194 }; 198 };
195 199
196 explicit BlobData(FileCompositionStatus composition) 200 explicit BlobData(FileCompositionStatus composition)
197 : m_fileComposition(composition) {} 201 : m_fileComposition(composition) {}
(...skipping 23 matching lines...) Expand all
221 static PassRefPtr<BlobDataHandle> create(const String& uuid, 225 static PassRefPtr<BlobDataHandle> create(const String& uuid,
222 const String& type, 226 const String& type,
223 long long size) { 227 long long size) {
224 return adoptRef(new BlobDataHandle(uuid, type, size)); 228 return adoptRef(new BlobDataHandle(uuid, type, size));
225 } 229 }
226 230
227 String uuid() const { return m_uuid.isolatedCopy(); } 231 String uuid() const { return m_uuid.isolatedCopy(); }
228 String type() const { return m_type.isolatedCopy(); } 232 String type() const { return m_type.isolatedCopy(); }
229 unsigned long long size() const { return m_size; } 233 unsigned long long size() const { return m_size; }
230 234
235 bool isSingleUnknownSizeFile() const { return m_isSingleUnknownSizeFile; }
236
231 ~BlobDataHandle(); 237 ~BlobDataHandle();
232 238
233 private: 239 private:
234 BlobDataHandle(); 240 BlobDataHandle();
235 BlobDataHandle(std::unique_ptr<BlobData>, long long size); 241 BlobDataHandle(std::unique_ptr<BlobData>, long long size);
236 BlobDataHandle(const String& uuid, const String& type, long long size); 242 BlobDataHandle(const String& uuid, const String& type, long long size);
237 243
238 const String m_uuid; 244 const String m_uuid;
239 const String m_type; 245 const String m_type;
240 const long long m_size; 246 const long long m_size;
247 const bool m_isSingleUnknownSizeFile;
241 }; 248 };
242 249
243 } // namespace blink 250 } // namespace blink
244 251
245 #endif // BlobData_h 252 #endif // BlobData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698