| OLD | NEW | 
|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/hash_tables.h" | 8 #include "base/hash_tables.h" | 
| 9 #include "base/process.h" | 9 #include "base/process.h" | 
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" | 
| 11 | 11 | 
| 12 class GURL; | 12 class GURL; | 
|  | 13 class FilePath; | 
| 13 | 14 | 
|  | 15 namespace base { | 
|  | 16 class Time; | 
|  | 17 } | 
| 14 namespace net { | 18 namespace net { | 
| 15 class UploadData; | 19 class UploadData; | 
| 16 } | 20 } | 
| 17 | 21 | 
| 18 namespace webkit_blob { | 22 namespace webkit_blob { | 
| 19 | 23 | 
| 20 class BlobData; | 24 class BlobData; | 
| 21 | 25 | 
| 22 // 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. | 
| 23 class BlobStorageController { | 27 class BlobStorageController { | 
| 24  public: | 28  public: | 
| 25   BlobStorageController(); | 29   BlobStorageController(); | 
| 26   ~BlobStorageController(); | 30   ~BlobStorageController(); | 
| 27 | 31 | 
| 28   void RegisterBlobUrl(const GURL& url, const BlobData* blob_data); | 32   void RegisterBlobUrl(const GURL& url, const BlobData* blob_data); | 
| 29   void RegisterBlobUrlFrom(const GURL& url, const GURL& src_url); | 33   void RegisterBlobUrlFrom(const GURL& url, const GURL& src_url); | 
| 30   void UnregisterBlobUrl(const GURL& url); | 34   void UnregisterBlobUrl(const GURL& url); | 
| 31   BlobData* GetBlobDataFromUrl(const GURL& url); | 35   BlobData* GetBlobDataFromUrl(const GURL& url); | 
| 32 | 36 | 
| 33   // If there is any blob reference in the upload data, it will get resolved | 37   // If there is any blob reference in the upload data, it will get resolved | 
| 34   // and updated in place. | 38   // and updated in place. | 
| 35   void ResolveBlobReferencesInUploadData(net::UploadData* upload_data); | 39   void ResolveBlobReferencesInUploadData(net::UploadData* upload_data); | 
| 36 | 40 | 
| 37  private: | 41  private: | 
| 38   void AppendStorageItems(BlobData* target_blob_data, | 42   void AppendStorageItems(BlobData* target_blob_data, | 
| 39                           BlobData* src_blob_data, | 43                           BlobData* src_blob_data, | 
| 40                           uint64 offset, | 44                           uint64 offset, | 
| 41                           uint64 length); | 45                           uint64 length); | 
|  | 46   void AppendFileItem(BlobData* target_blob_data, | 
|  | 47                       const FilePath& file_path, uint64 offset, uint64 length, | 
|  | 48                       const base::Time& expected_modification_time); | 
| 42 | 49 | 
| 43   typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap; | 50   typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap; | 
| 44   BlobMap blob_map_; | 51   BlobMap blob_map_; | 
| 45 | 52 | 
| 46   DISALLOW_COPY_AND_ASSIGN(BlobStorageController); | 53   DISALLOW_COPY_AND_ASSIGN(BlobStorageController); | 
| 47 }; | 54 }; | 
| 48 | 55 | 
| 49 }  // namespace webkit_blob | 56 }  // namespace webkit_blob | 
| 50 | 57 | 
| 51 #endif  // WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ | 58 #endif  // WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ | 
| OLD | NEW | 
|---|