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

Side by Side Diff: webkit/blob/blob_storage_controller.h

Issue 7974011: Break large blobs into multiple ipcs during creation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
OLDNEW
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 "base/hash_tables.h" 8 #include "base/hash_tables.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/process.h" 10 #include "base/process.h"
11 #include "webkit/blob/blob_data.h"
11 12
12 class GURL; 13 class GURL;
13 class FilePath; 14 class FilePath;
14 15
15 namespace base { 16 namespace base {
16 class Time; 17 class Time;
17 } 18 }
18 namespace net { 19 namespace net {
19 class UploadData; 20 class UploadData;
20 } 21 }
21 22
22 namespace webkit_blob { 23 namespace webkit_blob {
23 24
24 class BlobData;
25
26 // This class handles the logistics of blob Storage within the browser process. 25 // This class handles the logistics of blob Storage within the browser process.
27 class BlobStorageController { 26 class BlobStorageController {
28 public: 27 public:
29 BlobStorageController(); 28 BlobStorageController();
30 ~BlobStorageController(); 29 ~BlobStorageController();
31 30
32 void RegisterBlobUrl(const GURL& url, const BlobData* blob_data); 31 void RegisterUnfinalizedBlobUrl(const GURL& url);
32 void AppendBlobDataItem(const GURL& url, const BlobData::Item& data_item);
33 void FinalizeBlob(const GURL& url, const std::string& content_type);
33 void RegisterBlobUrlFrom(const GURL& url, const GURL& src_url); 34 void RegisterBlobUrlFrom(const GURL& url, const GURL& src_url);
34 void UnregisterBlobUrl(const GURL& url); 35 void UnregisterBlobUrl(const GURL& url);
35 BlobData* GetBlobDataFromUrl(const GURL& url); 36 BlobData* GetBlobDataFromUrl(const GURL& url);
36 37
37 // If there is any blob reference in the upload data, it will get resolved 38 // If there is any blob reference in the upload data, it will get resolved
38 // and updated in place. 39 // and updated in place.
39 void ResolveBlobReferencesInUploadData(net::UploadData* upload_data); 40 void ResolveBlobReferencesInUploadData(net::UploadData* upload_data);
40 41
41 private: 42 private:
42 friend class ViewBlobInternalsJob; 43 friend class ViewBlobInternalsJob;
43 44
44 void AppendStorageItems(BlobData* target_blob_data, 45 void AppendStorageItems(BlobData* target_blob_data,
45 BlobData* src_blob_data, 46 BlobData* src_blob_data,
46 uint64 offset, 47 uint64 offset,
47 uint64 length); 48 uint64 length);
48 void AppendFileItem(BlobData* target_blob_data, 49 void AppendFileItem(BlobData* target_blob_data,
49 const FilePath& file_path, uint64 offset, uint64 length, 50 const FilePath& file_path, uint64 offset, uint64 length,
50 const base::Time& expected_modification_time); 51 const base::Time& expected_modification_time);
51 52
53 void GetUnfinalizedBlobDataFromUrl(const GURL& url);
54
52 typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap; 55 typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap;
53 BlobMap blob_map_; 56 BlobMap blob_map_;
57 BlobMap unfinalized_blob_map_;
58 int64 memory_usage_;
jianli 2011/09/23 23:00:42 Please add comment for this variable.
michaeln 2011/09/24 01:15:24 I thought memory_usage_ was mnemonic enough. What
jianli 2011/09/27 01:12:18 Better to comment about what kind of stuffs are co
michaeln 2011/09/27 23:27:31 Done.
54 59
55 DISALLOW_COPY_AND_ASSIGN(BlobStorageController); 60 DISALLOW_COPY_AND_ASSIGN(BlobStorageController);
56 }; 61 };
57 62
58 } // namespace webkit_blob 63 } // namespace webkit_blob
59 64
60 #endif // WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_ 65 #endif // WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698