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