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

Unified Diff: webkit/blob/blob_data.h

Issue 10444010: Revert 138554 - Prevent zero-length items from being appended to a blob. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/fileapi/webblobregistry_impl.cc ('k') | webkit/blob/blob_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/blob/blob_data.h
===================================================================
--- webkit/blob/blob_data.h (revision 138789)
+++ webkit/blob/blob_data.h (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -85,12 +85,24 @@
AppendData(data.c_str(), data.size());
}
- void AppendData(const char* data, size_t length);
+ void AppendData(const char* data, size_t length) {
+ if (length > 0) {
+ items_.push_back(Item());
+ items_.back().SetToData(data, length);
+ }
+ }
void AppendFile(const FilePath& file_path, uint64 offset, uint64 length,
- const base::Time& expected_modification_time);
+ const base::Time& expected_modification_time) {
+ items_.push_back(Item());
+ items_.back().SetToFile(file_path, offset, length,
+ expected_modification_time);
+ }
- void AppendBlob(const GURL& blob_url, uint64 offset, uint64 length);
+ void AppendBlob(const GURL& blob_url, uint64 offset, uint64 length) {
+ items_.push_back(Item());
+ items_.back().SetToBlob(blob_url, offset, length);
+ }
void AttachShareableFileReference(ShareableFileReference* reference) {
shareable_files_.push_back(reference);
@@ -110,7 +122,15 @@
content_disposition_ = content_disposition;
}
- int64 GetMemoryUsage() const;
+ int64 GetMemoryUsage() const {
+ int64 memory = 0;
+ for (std::vector<Item>::const_iterator iter = items_.begin();
+ iter != items_.end(); ++iter) {
+ if (iter->type == TYPE_DATA)
+ memory += iter->data.size();
+ }
+ return memory;
+ }
private:
friend class base::RefCounted<BlobData>;
« no previous file with comments | « content/common/fileapi/webblobregistry_impl.cc ('k') | webkit/blob/blob_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698