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

Side by Side Diff: extensions/browser/blob_holder.cc

Issue 250143002: Media Galleries API: Audio/Video attached pictures support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux_chromium_chromeos_rel argument evaluation order bug Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/api_test/media_galleries/media_metadata/test.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 } 37 }
38 38
39 BlobHolder::~BlobHolder() { 39 BlobHolder::~BlobHolder() {
40 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 40 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
41 } 41 }
42 42
43 void BlobHolder::HoldBlobReference(scoped_ptr<content::BlobHandle> blob) { 43 void BlobHolder::HoldBlobReference(scoped_ptr<content::BlobHandle> blob) {
44 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 44 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
45 DCHECK(!ContainsBlobHandle(blob.get())); 45 DCHECK(!ContainsBlobHandle(blob.get()));
46 46
47 held_blobs_.insert( 47 std::string uuid = blob->GetUUID();
48 make_pair(blob->GetUUID(), make_linked_ptr(blob.release()))); 48 held_blobs_.insert(make_pair(uuid, make_linked_ptr(blob.release())));
49 } 49 }
50 50
51 BlobHolder::BlobHolder(content::RenderProcessHost* render_process_host) 51 BlobHolder::BlobHolder(content::RenderProcessHost* render_process_host)
52 : render_process_host_(render_process_host) { 52 : render_process_host_(render_process_host) {
53 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 53 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
54 } 54 }
55 55
56 bool BlobHolder::ContainsBlobHandle(content::BlobHandle* handle) const { 56 bool BlobHolder::ContainsBlobHandle(content::BlobHandle* handle) const {
57 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 57 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
58 for (BlobHandleMultimap::const_iterator it = held_blobs_.begin(); 58 for (BlobHandleMultimap::const_iterator it = held_blobs_.begin();
(...skipping 17 matching lines...) Expand all
76 held_blobs_.erase(it); 76 held_blobs_.erase(it);
77 } else { 77 } else {
78 DLOG(ERROR) << "Tried to release a Blob we don't have ownership to." 78 DLOG(ERROR) << "Tried to release a Blob we don't have ownership to."
79 << "UUID: " << *uuid_it; 79 << "UUID: " << *uuid_it;
80 render_process_host_->ReceivedBadMessage(); 80 render_process_host_->ReceivedBadMessage();
81 } 81 }
82 } 82 }
83 } 83 }
84 84
85 } // namespace extensions 85 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/media_galleries/media_metadata/test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698