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

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

Issue 280393003: Blobs: Catching browser-process created Blobs in extension code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use multimap<string, linked_ptr<BlobHandle> > to solve complexity issue Created 6 years, 7 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 | « no previous file | extensions/browser/blob_holder.cc » ('j') | extensions/browser/blob_holder.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef EXTENSIONS_BROWSER_BLOB_HOLDER_H_
6 #define EXTENSIONS_BROWSER_BLOB_HOLDER_H_
7
8 #include <map>
9
10 #include "base/memory/linked_ptr.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/supports_user_data.h"
13
14 namespace content {
15 class BlobHandle;
16 class RenderProcessHost;
17 }
18
19 namespace extensions {
20
21 class ExtensionMessageFilter;
22
23 // Used for holding onto Blobs created into the browser process until a
24 // renderer takes over ownership. This class operates on the UI thread.
25 class BlobHolder : public base::SupportsUserData::Data {
26 public:
27 // Will create the BlobHolder if it doesn't already exist.
28 static BlobHolder* FromRenderProcessHost(
29 content::RenderProcessHost* render_process_host);
30
31 virtual ~BlobHolder();
32
33 // Causes BlobHolder to take ownership of |blob|.
34 void HoldBlobReference(scoped_ptr<content::BlobHandle> blob);
35
36 private:
37 typedef std::multimap<std::string, linked_ptr<content::BlobHandle> >
Yoyo Zhou 2014/05/23 22:14:00 Why is this a multimap rather than a map? If uuids
michaeln 2014/05/23 23:49:42 i can answer that, blobHandle != blob, there can b
tommycli 2014/05/23 23:52:47 content::BlobHandle is copyable and roughly serves
38 BlobHandleMultimap;
39
40 explicit BlobHolder(content::RenderProcessHost* render_process_host);
41
42 // BlobHolder will drop a blob handle for each element in blob_uuids.
43 // If caller wishes to drop multiple references to the same blob,
44 // |blob_uuids| may contain duplicate UUIDs.
45 void DropBlobs(const std::vector<std::string>& blob_uuids);
46 friend class ExtensionMessageFilter;
47
48 bool ContainsBlobHandle(content::BlobHandle* handle) const;
49
50 // A reference to the owner of this class.
51 content::RenderProcessHost* render_process_host_;
52
53 BlobHandleMultimap held_blobs_;
54
55 DISALLOW_COPY_AND_ASSIGN(BlobHolder);
56 };
57
58 } // namespace extensions
59
60 #endif // EXTENSIONS_BROWSER_BLOB_HOLDER_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/blob_holder.cc » ('j') | extensions/browser/blob_holder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698