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

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

Issue 23223003: Chromium Blob hacking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | « webkit/browser/blob/blob_data_handle.h ('k') | webkit/browser/blob/blob_storage_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "webkit/browser/blob/blob_data_handle.h"
14 #include "webkit/browser/webkit_storage_browser_export.h" 15 #include "webkit/browser/webkit_storage_browser_export.h"
15 #include "webkit/common/blob/blob_data.h" 16 #include "webkit/common/blob/blob_data.h"
16 17
17 class GURL; 18 class GURL;
18 19
19 namespace base { 20 namespace base {
20 class FilePath; 21 class FilePath;
21 class Time; 22 class Time;
22 } 23 }
23 24
(...skipping 11 matching lines...) Expand all
35 BlobStorageContext(); 36 BlobStorageContext();
36 ~BlobStorageContext(); 37 ~BlobStorageContext();
37 38
38 scoped_ptr<BlobDataHandle> GetBlobDataFromUUID(const std::string& uuid); 39 scoped_ptr<BlobDataHandle> GetBlobDataFromUUID(const std::string& uuid);
39 scoped_ptr<BlobDataHandle> GetBlobDataFromPublicURL(const GURL& url); 40 scoped_ptr<BlobDataHandle> GetBlobDataFromPublicURL(const GURL& url);
40 41
41 // Useful for coining blobs from within the browser process. If the 42 // Useful for coining blobs from within the browser process. If the
42 // blob cannot be added due to memory consumption, returns NULL. 43 // blob cannot be added due to memory consumption, returns NULL.
43 scoped_ptr<BlobDataHandle> AddFinishedBlob(const BlobData* blob_data); 44 scoped_ptr<BlobDataHandle> AddFinishedBlob(const BlobData* blob_data);
44 45
46 // Temporary support for mapping oldstyle blobUrls to new style uuids.
47 std::string LookupUuidFromDeprecatedURL(const GURL& url);
48
45 private: 49 private:
46 friend class BlobDataHandle; 50 friend class BlobDataHandle;
47 friend class BlobStorageHost; 51 friend class BlobStorageHost;
52 friend class ViewBlobInternalsJob;
48 53
49 enum EntryFlags { 54 enum EntryFlags {
50 BEING_BUILT = 1 << 0, 55 BEING_BUILT = 1 << 0,
51 EXCEEDED_MEMORY = 1 << 1, 56 EXCEEDED_MEMORY = 1 << 1,
52 }; 57 };
53 58
54 struct BlobMapEntry { 59 struct BlobMapEntry {
55 int refcount; 60 int refcount;
56 int flags; 61 int flags;
57 scoped_refptr<BlobData> data; 62 scoped_refptr<BlobData> data;
(...skipping 10 matching lines...) Expand all
68 void StartBuildingBlob(const std::string& uuid); 73 void StartBuildingBlob(const std::string& uuid);
69 void AppendBlobDataItem(const std::string& uuid, 74 void AppendBlobDataItem(const std::string& uuid,
70 const BlobData::Item& data_item); 75 const BlobData::Item& data_item);
71 void FinishBuildingBlob(const std::string& uuid, const std::string& type); 76 void FinishBuildingBlob(const std::string& uuid, const std::string& type);
72 void CancelBuildingBlob(const std::string& uuid); 77 void CancelBuildingBlob(const std::string& uuid);
73 void IncrementBlobRefCount(const std::string& uuid); 78 void IncrementBlobRefCount(const std::string& uuid);
74 void DecrementBlobRefCount(const std::string& uuid); 79 void DecrementBlobRefCount(const std::string& uuid);
75 void RegisterPublicBlobURL(const GURL& url, const std::string& uuid); 80 void RegisterPublicBlobURL(const GURL& url, const std::string& uuid);
76 void RevokePublicBlobURL(const GURL& url); 81 void RevokePublicBlobURL(const GURL& url);
77 82
83 // Temporary support for mapping old style blobUrls to new style uuids.
84 void DeprecatedRegisterPrivateBlobURL(const GURL& url,
85 const std::string& uuid);
86 void DeprecatedRevokePrivateBlobURL(const GURL& url);
87
78 bool ExpandStorageItems(BlobData* target_blob_data, 88 bool ExpandStorageItems(BlobData* target_blob_data,
79 BlobData* src_blob_data, 89 BlobData* src_blob_data,
80 uint64 offset, 90 uint64 offset,
81 uint64 length); 91 uint64 length);
82 bool AppendBytesItem(BlobData* target_blob_data, 92 bool AppendBytesItem(BlobData* target_blob_data,
83 const char* data, int64 length); 93 const char* data, int64 length);
84 void AppendFileItem(BlobData* target_blob_data, 94 void AppendFileItem(BlobData* target_blob_data,
85 const base::FilePath& file_path, 95 const base::FilePath& file_path,
86 uint64 offset, uint64 length, 96 uint64 offset, uint64 length,
87 const base::Time& expected_modification_time); 97 const base::Time& expected_modification_time);
88 void AppendFileSystemFileItem( 98 void AppendFileSystemFileItem(
89 BlobData* target_blob_data, 99 BlobData* target_blob_data,
90 const GURL& url, uint64 offset, uint64 length, 100 const GURL& url, uint64 offset, uint64 length,
91 const base::Time& expected_modification_time); 101 const base::Time& expected_modification_time);
92 102
93 bool IsInUse(const std::string& uuid); 103 bool IsInUse(const std::string& uuid);
94 bool IsBeingBuilt(const std::string& uuid); 104 bool IsBeingBuilt(const std::string& uuid);
95 bool IsUrlRegistered(const GURL& blob_url); 105 bool IsUrlRegistered(const GURL& blob_url);
96 106
97 BlobMap blob_map_; 107 BlobMap blob_map_;
98 BlobURLMap public_blob_urls_; 108 BlobURLMap public_blob_urls_;
109 BlobURLMap deprecated_blob_urls_;
99 110
100 // Used to keep track of how much memory is being utitlized for blob data, 111 // Used to keep track of how much memory is being utitlized for blob data,
101 // we count only the items of TYPE_DATA which are held in memory and not 112 // we count only the items of TYPE_DATA which are held in memory and not
102 // items of TYPE_FILE. 113 // items of TYPE_FILE.
103 int64 memory_usage_; 114 int64 memory_usage_;
104 115
105 DISALLOW_COPY_AND_ASSIGN(BlobStorageContext); 116 DISALLOW_COPY_AND_ASSIGN(BlobStorageContext);
106 }; 117 };
107 118
108 } // namespace webkit_blob 119 } // namespace webkit_blob
109 120
110 #endif // WEBKIT_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ 121 #endif // WEBKIT_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_
OLDNEW
« no previous file with comments | « webkit/browser/blob/blob_data_handle.h ('k') | webkit/browser/blob/blob_storage_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698