OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BLOB_BLOB_STORAGE_CONTROLLER_H_ | 5 #ifndef WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ |
6 #define WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ | 6 #define WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/process.h" | 13 #include "base/process.h" |
14 #include "webkit/blob/blob_data.h" | 14 #include "webkit/blob/blob_data.h" |
15 #include "webkit/blob/blob_export.h" | 15 #include "webkit/blob/blob_export.h" |
16 | 16 |
17 class GURL; | 17 class GURL; |
18 class FilePath; | 18 class FilePath; |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class Time; | 21 class Time; |
22 } | 22 } |
23 namespace net { | |
24 class UploadData; | |
25 } | |
26 | 23 |
27 namespace webkit_blob { | 24 namespace webkit_blob { |
28 | 25 |
29 // This class handles the logistics of blob Storage within the browser process. | 26 // This class handles the logistics of blob Storage within the browser process. |
30 class BLOB_EXPORT BlobStorageController { | 27 class BLOB_EXPORT BlobStorageController { |
31 public: | 28 public: |
32 BlobStorageController(); | 29 BlobStorageController(); |
33 ~BlobStorageController(); | 30 ~BlobStorageController(); |
34 | 31 |
35 void StartBuildingBlob(const GURL& url); | 32 void StartBuildingBlob(const GURL& url); |
36 void AppendBlobDataItem(const GURL& url, const BlobData::Item& data_item); | 33 void AppendBlobDataItem(const GURL& url, const BlobData::Item& data_item); |
37 void FinishBuildingBlob(const GURL& url, const std::string& content_type); | 34 void FinishBuildingBlob(const GURL& url, const std::string& content_type); |
38 void AddFinishedBlob(const GURL& url, const BlobData* blob_data); | 35 void AddFinishedBlob(const GURL& url, const BlobData* blob_data); |
39 void CloneBlob(const GURL& url, const GURL& src_url); | 36 void CloneBlob(const GURL& url, const GURL& src_url); |
40 void RemoveBlob(const GURL& url); | 37 void RemoveBlob(const GURL& url); |
41 BlobData* GetBlobDataFromUrl(const GURL& url); | 38 BlobData* GetBlobDataFromUrl(const GURL& url); |
42 | 39 |
43 // If there is any blob reference in the upload data, it will get resolved | |
44 // and updated in place. | |
45 void ResolveBlobReferencesInUploadData(net::UploadData* upload_data); | |
46 | |
47 private: | 40 private: |
48 friend class ViewBlobInternalsJob; | 41 friend class ViewBlobInternalsJob; |
49 | 42 |
50 typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap; | 43 typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap; |
51 typedef std::map<BlobData*, int> BlobDataUsageMap; | 44 typedef std::map<BlobData*, int> BlobDataUsageMap; |
52 | 45 |
53 void AppendStorageItems(BlobData* target_blob_data, | 46 void AppendStorageItems(BlobData* target_blob_data, |
54 BlobData* src_blob_data, | 47 BlobData* src_blob_data, |
55 uint64 offset, | 48 uint64 offset, |
56 uint64 length); | 49 uint64 length); |
(...skipping 18 matching lines...) Expand all Loading... |
75 // Multiple urls can refer to the same blob data, this map keeps track of | 68 // Multiple urls can refer to the same blob data, this map keeps track of |
76 // how many urls refer to a BlobData. | 69 // how many urls refer to a BlobData. |
77 BlobDataUsageMap blob_data_usage_count_; | 70 BlobDataUsageMap blob_data_usage_count_; |
78 | 71 |
79 DISALLOW_COPY_AND_ASSIGN(BlobStorageController); | 72 DISALLOW_COPY_AND_ASSIGN(BlobStorageController); |
80 }; | 73 }; |
81 | 74 |
82 } // namespace webkit_blob | 75 } // namespace webkit_blob |
83 | 76 |
84 #endif // WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ | 77 #endif // WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ |
OLD | NEW |