| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 BlobHolder* new_instance = new BlobHolder(render_process_host); | 35 BlobHolder* new_instance = new BlobHolder(render_process_host); |
| 36 render_process_host->SetUserData(&kBlobHolderUserDataKey, new_instance); | 36 render_process_host->SetUserData(&kBlobHolderUserDataKey, new_instance); |
| 37 return new_instance; | 37 return new_instance; |
| 38 } | 38 } |
| 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(scoped_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, make_linked_ptr(blob.release()))); |
| 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); |
| (...skipping 23 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 |