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

Side by Side Diff: storage/browser/blob/blob_data_snapshot.cc

Issue 1234813004: [BlobAsync] Asynchronous Blob Construction Final Patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blob-protocol-change
Patch Set: added shared memory test, and fixed memory leak Created 4 years, 10 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "storage/browser/blob/blob_data_snapshot.h" 8 #include "storage/browser/blob/blob_data_snapshot.h"
9 9
10 namespace storage { 10 namespace storage {
(...skipping 29 matching lines...) Expand all
40 40
41 size_t BlobDataSnapshot::GetMemoryUsage() const { 41 size_t BlobDataSnapshot::GetMemoryUsage() const {
42 int64_t memory = 0; 42 int64_t memory = 0;
43 for (const auto& data_item : items_) { 43 for (const auto& data_item : items_) {
44 if (data_item->type() == DataElement::TYPE_BYTES) 44 if (data_item->type() == DataElement::TYPE_BYTES)
45 memory += data_item->length(); 45 memory += data_item->length();
46 } 46 }
47 return memory; 47 return memory;
48 } 48 }
49 49
50 void PrintTo(const BlobDataSnapshot& x, std::ostream* os) {
51 DCHECK(os);
52 *os << "<BlobDataSnapshot>{uuid: " << x.uuid()
53 << ", content_type: " << x.content_type_
54 << ", content_disposition: " << x.content_disposition_ << ", items: [";
55 for (const auto& item : x.items_) {
56 PrintTo(*item, os);
57 *os << ", ";
58 }
59 *os << "]}";
60 }
61
50 } // namespace storage 62 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698