| OLD | NEW |
| 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 #include "storage/browser/blob/internal_blob_data.h" | 5 #include "storage/browser/blob/internal_blob_data.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| 10 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 11 #include "storage/browser/blob/blob_data_item.h" | 12 #include "storage/browser/blob/blob_data_item.h" |
| 12 #include "storage/common/data_element.h" | 13 #include "storage/common/data_element.h" |
| 13 | 14 |
| 14 namespace storage { | 15 namespace storage { |
| 15 | 16 |
| 16 InternalBlobData::Builder::Builder() : data_(new InternalBlobData()) { | 17 InternalBlobData::Builder::Builder() : data_(new InternalBlobData()) { |
| 17 } | 18 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 43 data_->content_disposition_ = content_disposition; | 44 data_->content_disposition_ = content_disposition; |
| 44 } | 45 } |
| 45 | 46 |
| 46 size_t InternalBlobData::Builder::GetNonsharedMemoryUsage() const { | 47 size_t InternalBlobData::Builder::GetNonsharedMemoryUsage() const { |
| 47 DCHECK(data_); | 48 DCHECK(data_); |
| 48 return data_->GetUnsharedMemoryUsage(); | 49 return data_->GetUnsharedMemoryUsage(); |
| 49 } | 50 } |
| 50 | 51 |
| 51 scoped_ptr<InternalBlobData> InternalBlobData::Builder::Build() { | 52 scoped_ptr<InternalBlobData> InternalBlobData::Builder::Build() { |
| 52 DCHECK(data_); | 53 DCHECK(data_); |
| 53 return data_.Pass(); | 54 return std::move(data_); |
| 54 } | 55 } |
| 55 | 56 |
| 56 InternalBlobData::InternalBlobData() { | 57 InternalBlobData::InternalBlobData() { |
| 57 } | 58 } |
| 58 | 59 |
| 59 InternalBlobData::~InternalBlobData() { | 60 InternalBlobData::~InternalBlobData() { |
| 60 } | 61 } |
| 61 | 62 |
| 62 const std::vector<scoped_refptr<ShareableBlobDataItem>>& | 63 const std::vector<scoped_refptr<ShareableBlobDataItem>>& |
| 63 InternalBlobData::items() const { | 64 InternalBlobData::items() const { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 if (data_item->referencing_blobs().size() == 1 && | 104 if (data_item->referencing_blobs().size() == 1 && |
| 104 seen_items.find(data_item.get()) == seen_items.end()) { | 105 seen_items.find(data_item.get()) == seen_items.end()) { |
| 105 *unshared_memory += data_item->item()->length(); | 106 *unshared_memory += data_item->item()->length(); |
| 106 seen_items.insert(data_item.get()); | 107 seen_items.insert(data_item.get()); |
| 107 } | 108 } |
| 108 } | 109 } |
| 109 } | 110 } |
| 110 } | 111 } |
| 111 | 112 |
| 112 } // namespace storage | 113 } // namespace storage |
| OLD | NEW |