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

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

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

Powered by Google App Engine
This is Rietveld 408576698