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

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: 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') | no next file with comments »
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 #include <string>
10 #include <vector>
11
12 #include "base/memory/linked_ptr.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/supports_user_data.h"
15
16 namespace content {
17 class BlobHandle;
18 class RenderProcessHost;
19 }
20
21 namespace extensions {
22
23 class ExtensionMessageFilter;
24
25 // Used for holding onto Blobs created into the browser process until a
26 // renderer takes over ownership. This class operates on the UI thread.
27 class BlobHolder : public base::SupportsUserData::Data {
28 public:
29 // Will create the BlobHolder if it doesn't already exist.
30 static BlobHolder* FromRenderProcessHost(
31 content::RenderProcessHost* render_process_host);
32
33 virtual ~BlobHolder();
34
35 // Causes BlobHolder to take ownership of |blob|.
36 void HoldBlobReference(scoped_ptr<content::BlobHandle> blob);
37
38 private:
39 typedef std::multimap<std::string, linked_ptr<content::BlobHandle> >
40 BlobHandleMultimap;
41
42 explicit BlobHolder(content::RenderProcessHost* render_process_host);
43
44 // BlobHolder will drop a blob handle for each element in blob_uuids.
45 // If caller wishes to drop multiple references to the same blob,
46 // |blob_uuids| may contain duplicate UUIDs.
47 void DropBlobs(const std::vector<std::string>& blob_uuids);
48 friend class ExtensionMessageFilter;
49
50 bool ContainsBlobHandle(content::BlobHandle* handle) const;
51
52 // A reference to the owner of this class.
53 content::RenderProcessHost* render_process_host_;
54
55 BlobHandleMultimap held_blobs_;
56
57 DISALLOW_COPY_AND_ASSIGN(BlobHolder);
58 };
59
60 } // namespace extensions
61
62 #endif // EXTENSIONS_BROWSER_BLOB_HOLDER_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/blob_holder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698