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

Side by Side Diff: content/child/blob_storage/blob_transport_controller.h

Issue 2055053003: [BlobAsync] Disk support for blob storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Combined BlobSlice & BlobFlattener files, more comments, a little cleanup. Created 4 years, 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_ 5 #ifndef CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_
6 #define CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_ 6 #define CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // asynchronously. Use CancelAllBlobTransfers to stop usage of the |sender|. 81 // asynchronously. Use CancelAllBlobTransfers to stop usage of the |sender|.
82 // We close the file handles once we're done writing to them. 82 // We close the file handles once we're done writing to them.
83 void OnMemoryRequest( 83 void OnMemoryRequest(
84 const std::string& uuid, 84 const std::string& uuid,
85 const std::vector<storage::BlobItemBytesRequest>& requests, 85 const std::vector<storage::BlobItemBytesRequest>& requests,
86 std::vector<base::SharedMemoryHandle>* memory_handles, 86 std::vector<base::SharedMemoryHandle>* memory_handles,
87 const std::vector<IPC::PlatformFileForTransit>& file_handles, 87 const std::vector<IPC::PlatformFileForTransit>& file_handles,
88 base::TaskRunner* file_runner, 88 base::TaskRunner* file_runner,
89 IPC::Sender* sender); 89 IPC::Sender* sender);
90 90
91 void OnCancel(const std::string& uuid, 91 void OnBlobStatus(const std::string& uuid, storage::BlobStatus code);
92 storage::IPCBlobCreationCancelCode code);
93
94 void OnDone(const std::string& uuid);
95 92
96 bool IsTransporting(const std::string& uuid) { 93 bool IsTransporting(const std::string& uuid) {
97 return blob_storage_.find(uuid) != blob_storage_.end(); 94 return blob_storage_.find(uuid) != blob_storage_.end();
98 } 95 }
99 96
100 // Invalidates all asynchronously running memory request handlers and clears 97 // Invalidates all asynchronously running memory request handlers and clears
101 // the internal state. If our map wasn't previously empty, then we call 98 // the internal state. If our map wasn't previously empty, then we call
102 // ChildProcess::ReleaseProcess to release our previous reference. 99 // ChildProcess::ReleaseProcess to release our previous reference.
103 void CancelAllBlobTransfers(); 100 void CancelAllBlobTransfers();
104 101
(...skipping 16 matching lines...) Expand all
121 static void GetDescriptions(BlobConsolidation* consolidation, 118 static void GetDescriptions(BlobConsolidation* consolidation,
122 size_t max_data_population, 119 size_t max_data_population,
123 std::vector<storage::DataElement>* out); 120 std::vector<storage::DataElement>* out);
124 121
125 BlobTransportController(); 122 BlobTransportController();
126 ~BlobTransportController(); 123 ~BlobTransportController();
127 124
128 void OnFileWriteComplete( 125 void OnFileWriteComplete(
129 IPC::Sender* sender, 126 IPC::Sender* sender,
130 const std::string& uuid, 127 const std::string& uuid,
131 const std::pair<std::vector<storage::BlobItemBytesResponse>, 128 const std::pair<storage::BlobStatus,
132 storage::IPCBlobCreationCancelCode>& result); 129 std::vector<storage::BlobItemBytesResponse>>& result);
133 130
134 void StoreBlobDataForRequests( 131 void StoreBlobDataForRequests(
135 const std::string& uuid, 132 const std::string& uuid,
136 scoped_refptr<BlobConsolidation> consolidation, 133 scoped_refptr<BlobConsolidation> consolidation,
137 scoped_refptr<base::SingleThreadTaskRunner> main_runner); 134 scoped_refptr<base::SingleThreadTaskRunner> main_runner);
138 135
139 // Deletes the consolidation and calls ChildProcess::ReleaseProcess. 136 // Deletes the consolidation and calls ChildProcess::ReleaseProcess.
140 void ReleaseBlobConsolidation(const std::string& uuid); 137 void ReleaseBlobConsolidation(const std::string& uuid);
141 138
142 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_; 139 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_;
143 std::map<std::string, scoped_refptr<BlobConsolidation>> blob_storage_; 140 std::map<std::string, scoped_refptr<BlobConsolidation>> blob_storage_;
144 base::WeakPtrFactory<BlobTransportController> weak_factory_; 141 base::WeakPtrFactory<BlobTransportController> weak_factory_;
145 142
146 DISALLOW_COPY_AND_ASSIGN(BlobTransportController); 143 DISALLOW_COPY_AND_ASSIGN(BlobTransportController);
147 }; 144 };
148 145
149 } // namespace content 146 } // namespace content
150 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_ 147 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698