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

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