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 #include "webkit/glue/resource_request_body.h" |
16 | 17 |
17 class GURL; | 18 class GURL; |
18 class FilePath; | 19 class FilePath; |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class Time; | 22 class Time; |
22 } | 23 } |
23 namespace net { | 24 |
24 class UploadData; | 25 namespace webkit_glue { |
| 26 class ResourceRequestBody; |
25 } | 27 } |
26 | 28 |
27 namespace webkit_blob { | 29 namespace webkit_blob { |
28 | 30 |
29 // This class handles the logistics of blob Storage within the browser process. | 31 // This class handles the logistics of blob Storage within the browser process. |
30 class BLOB_EXPORT BlobStorageController { | 32 class BLOB_EXPORT BlobStorageController { |
31 public: | 33 public: |
32 BlobStorageController(); | 34 BlobStorageController(); |
33 ~BlobStorageController(); | 35 ~BlobStorageController(); |
34 | 36 |
35 void StartBuildingBlob(const GURL& url); | 37 void StartBuildingBlob(const GURL& url); |
36 void AppendBlobDataItem(const GURL& url, const BlobData::Item& data_item); | 38 void AppendBlobDataItem(const GURL& url, const BlobData::Item& data_item); |
37 void FinishBuildingBlob(const GURL& url, const std::string& content_type); | 39 void FinishBuildingBlob(const GURL& url, const std::string& content_type); |
38 void AddFinishedBlob(const GURL& url, const BlobData* blob_data); | 40 void AddFinishedBlob(const GURL& url, const BlobData* blob_data); |
39 void CloneBlob(const GURL& url, const GURL& src_url); | 41 void CloneBlob(const GURL& url, const GURL& src_url); |
40 void RemoveBlob(const GURL& url); | 42 void RemoveBlob(const GURL& url); |
41 BlobData* GetBlobDataFromUrl(const GURL& url); | 43 BlobData* GetBlobDataFromUrl(const GURL& url); |
42 | 44 |
43 // If there is any blob reference in the upload data, it will get resolved | 45 // If there is any blob reference in the resource request body, it will get |
44 // and updated in place. | 46 // resolved and updated in place. |
45 void ResolveBlobReferencesInUploadData(net::UploadData* upload_data); | 47 void ResolveBlobReferencesInResourceRequestBody( |
| 48 webkit_glue::ResourceRequestBody* resource_request_body); |
46 | 49 |
47 private: | 50 private: |
48 friend class ViewBlobInternalsJob; | 51 friend class ViewBlobInternalsJob; |
49 | 52 |
50 typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap; | 53 typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap; |
51 typedef std::map<BlobData*, int> BlobDataUsageMap; | 54 typedef std::map<BlobData*, int> BlobDataUsageMap; |
52 | 55 |
53 void AppendStorageItems(BlobData* target_blob_data, | 56 void AppendStorageItems(BlobData* target_blob_data, |
54 BlobData* src_blob_data, | 57 BlobData* src_blob_data, |
55 uint64 offset, | 58 uint64 offset, |
(...skipping 19 matching lines...) Expand all Loading... |
75 // Multiple urls can refer to the same blob data, this map keeps track of | 78 // Multiple urls can refer to the same blob data, this map keeps track of |
76 // how many urls refer to a BlobData. | 79 // how many urls refer to a BlobData. |
77 BlobDataUsageMap blob_data_usage_count_; | 80 BlobDataUsageMap blob_data_usage_count_; |
78 | 81 |
79 DISALLOW_COPY_AND_ASSIGN(BlobStorageController); | 82 DISALLOW_COPY_AND_ASSIGN(BlobStorageController); |
80 }; | 83 }; |
81 | 84 |
82 } // namespace webkit_blob | 85 } // namespace webkit_blob |
83 | 86 |
84 #endif // WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ | 87 #endif // WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ |
OLD | NEW |