OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/blob_holder.h" | 5 #include "extensions/browser/blob_holder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 BlobHolder::~BlobHolder() { | 40 BlobHolder::~BlobHolder() { |
41 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 41 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
42 } | 42 } |
43 | 43 |
44 void BlobHolder::HoldBlobReference(std::unique_ptr<content::BlobHandle> blob) { | 44 void BlobHolder::HoldBlobReference(std::unique_ptr<content::BlobHandle> blob) { |
45 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 45 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
46 DCHECK(!ContainsBlobHandle(blob.get())); | 46 DCHECK(!ContainsBlobHandle(blob.get())); |
47 | 47 |
48 std::string uuid = blob->GetUUID(); | 48 std::string uuid = blob->GetUUID(); |
49 held_blobs_.insert(make_pair(uuid, make_linked_ptr(blob.release()))); | 49 held_blobs_.insert(make_pair(uuid, std::move(blob))); |
50 } | 50 } |
51 | 51 |
52 BlobHolder::BlobHolder(content::RenderProcessHost* render_process_host) | 52 BlobHolder::BlobHolder(content::RenderProcessHost* render_process_host) |
53 : render_process_host_(render_process_host) { | 53 : render_process_host_(render_process_host) { |
54 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 54 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
55 } | 55 } |
56 | 56 |
57 bool BlobHolder::ContainsBlobHandle(content::BlobHandle* handle) const { | 57 bool BlobHolder::ContainsBlobHandle(content::BlobHandle* handle) const { |
58 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 58 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
59 for (BlobHandleMultimap::const_iterator it = held_blobs_.begin(); | 59 for (BlobHandleMultimap::const_iterator it = held_blobs_.begin(); |
(...skipping 18 matching lines...) Expand all Loading... |
78 } else { | 78 } else { |
79 DLOG(ERROR) << "Tried to release a Blob we don't have ownership to." | 79 DLOG(ERROR) << "Tried to release a Blob we don't have ownership to." |
80 << "UUID: " << *uuid_it; | 80 << "UUID: " << *uuid_it; |
81 bad_message::ReceivedBadMessage(render_process_host_, | 81 bad_message::ReceivedBadMessage(render_process_host_, |
82 bad_message::BH_BLOB_NOT_OWNED); | 82 bad_message::BH_BLOB_NOT_OWNED); |
83 } | 83 } |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 } // namespace extensions | 87 } // namespace extensions |
OLD | NEW |