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

Side by Side Diff: webkit/browser/blob/blob_storage_context.h

Issue 259773006: Allow BlobDataHandles to be copied, and have their UUIDs read, on any thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Experimental Windows build fix 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 WEBKIT_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ 5 #ifndef WEBKIT_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_
6 #define WEBKIT_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ 6 #define WEBKIT_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 11 matching lines...) Expand all
22 class Time; 22 class Time;
23 } 23 }
24 24
25 namespace content { 25 namespace content {
26 class BlobStorageHost; 26 class BlobStorageHost;
27 } 27 }
28 28
29 namespace webkit_blob { 29 namespace webkit_blob {
30 30
31 class BlobDataHandle; 31 class BlobDataHandle;
32 class BlobDataHandleShared;
michaeln 2014/04/28 18:25:22 this doesn't look meaningful since it's really an
ericu 2014/04/28 18:43:01 Done.
32 33
33 // This class handles the logistics of blob Storage within the browser process, 34 // This class handles the logistics of blob Storage within the browser process,
34 // and maintains a mapping from blob uuid to the data. The class is single 35 // and maintains a mapping from blob uuid to the data. The class is single
35 // threaded and should only be used on the IO thread. 36 // threaded and should only be used on the IO thread.
36 // In chromium, there is one instance per profile. 37 // In chromium, there is one instance per profile.
37 class WEBKIT_STORAGE_BROWSER_EXPORT BlobStorageContext 38 class WEBKIT_STORAGE_BROWSER_EXPORT BlobStorageContext
38 : public base::SupportsWeakPtr<BlobStorageContext> { 39 : public base::SupportsWeakPtr<BlobStorageContext> {
39 public: 40 public:
40 BlobStorageContext(); 41 BlobStorageContext();
41 ~BlobStorageContext(); 42 ~BlobStorageContext();
42 43
43 scoped_ptr<BlobDataHandle> GetBlobDataFromUUID(const std::string& uuid); 44 scoped_ptr<BlobDataHandle> GetBlobDataFromUUID(const std::string& uuid);
44 scoped_ptr<BlobDataHandle> GetBlobDataFromPublicURL(const GURL& url); 45 scoped_ptr<BlobDataHandle> GetBlobDataFromPublicURL(const GURL& url);
45 46
46 // Useful for coining blobs from within the browser process. If the 47 // Useful for coining blobs from within the browser process. If the
47 // blob cannot be added due to memory consumption, returns NULL. 48 // blob cannot be added due to memory consumption, returns NULL.
48 scoped_ptr<BlobDataHandle> AddFinishedBlob(const BlobData* blob_data); 49 scoped_ptr<BlobDataHandle> AddFinishedBlob(const BlobData* blob_data);
49 50
50 // Useful for coining blob urls from within the browser process. 51 // Useful for coining blob urls from within the browser process.
51 bool RegisterPublicBlobURL(const GURL& url, const std::string& uuid); 52 bool RegisterPublicBlobURL(const GURL& url, const std::string& uuid);
52 void RevokePublicBlobURL(const GURL& url); 53 void RevokePublicBlobURL(const GURL& url);
53 54
54 private: 55 private:
55 friend class content::BlobStorageHost; 56 friend class content::BlobStorageHost;
56 friend class BlobDataHandle; 57 friend class BlobDataHandle::BlobDataHandleShared;
57 friend class ViewBlobInternalsJob; 58 friend class ViewBlobInternalsJob;
58 59
59 enum EntryFlags { 60 enum EntryFlags {
60 BEING_BUILT = 1 << 0, 61 BEING_BUILT = 1 << 0,
61 EXCEEDED_MEMORY = 1 << 1, 62 EXCEEDED_MEMORY = 1 << 1,
62 }; 63 };
63 64
64 struct BlobMapEntry { 65 struct BlobMapEntry {
65 int refcount; 66 int refcount;
66 int flags; 67 int flags;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // we count only the items of TYPE_DATA which are held in memory and not 110 // we count only the items of TYPE_DATA which are held in memory and not
110 // items of TYPE_FILE. 111 // items of TYPE_FILE.
111 int64 memory_usage_; 112 int64 memory_usage_;
112 113
113 DISALLOW_COPY_AND_ASSIGN(BlobStorageContext); 114 DISALLOW_COPY_AND_ASSIGN(BlobStorageContext);
114 }; 115 };
115 116
116 } // namespace webkit_blob 117 } // namespace webkit_blob
117 118
118 #endif // WEBKIT_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ 119 #endif // WEBKIT_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_
OLDNEW
« webkit/browser/blob/blob_data_handle.cc ('K') | « webkit/browser/blob/blob_data_handle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698