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

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

Issue 1988983003: [BlobStorage] Fix IPC race in sending IPC and posting to IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix one test Created 4 years, 7 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
« no previous file with comments | « no previous file | content/child/blob_storage/blob_transport_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // ChildProcess::ReleaseProcess to release our previous reference. 103 // ChildProcess::ReleaseProcess to release our previous reference.
104 void ClearForTesting(); 104 void ClearForTesting();
105 105
106 enum class ResponsesStatus { 106 enum class ResponsesStatus {
107 BLOB_NOT_FOUND, 107 BLOB_NOT_FOUND,
108 SHARED_MEMORY_MAP_FAILED, 108 SHARED_MEMORY_MAP_FAILED,
109 SUCCESS 109 SUCCESS
110 }; 110 };
111 friend struct base::DefaultLazyInstanceTraits<BlobTransportController>; 111 friend struct base::DefaultLazyInstanceTraits<BlobTransportController>;
112 112
113 static void InitiateBlobTransferOnIOThread(
114 const std::string& uuid,
115 const std::string& content_type,
116 std::unique_ptr<BlobConsolidation> consolidation,
117 scoped_refptr<ThreadSafeSender> sender,
118 scoped_refptr<base::SingleThreadTaskRunner> main_runner);
119
113 void StoreBlobDataForRequests( 120 void StoreBlobDataForRequests(
114 const std::string& uuid, 121 const std::string& uuid,
115 std::unique_ptr<BlobConsolidation> consolidation, 122 std::unique_ptr<BlobConsolidation> consolidation,
116 scoped_refptr<base::SingleThreadTaskRunner> main_runner); 123 scoped_refptr<base::SingleThreadTaskRunner> main_runner);
117 124
118 ResponsesStatus GetResponses( 125 ResponsesStatus GetResponses(
119 const std::string& uuid, 126 const std::string& uuid,
120 const std::vector<storage::BlobItemBytesRequest>& requests, 127 const std::vector<storage::BlobItemBytesRequest>& requests,
121 std::vector<base::SharedMemoryHandle>* memory_handles, 128 std::vector<base::SharedMemoryHandle>* memory_handles,
122 const std::vector<IPC::PlatformFileForTransit>& file_handles, 129 const std::vector<IPC::PlatformFileForTransit>& file_handles,
123 std::vector<storage::BlobItemBytesResponse>* output); 130 std::vector<storage::BlobItemBytesResponse>* output);
124 131
125 // Deletes the consolidation, and if we removed the last consolidation from 132 // Deletes the consolidation, and if we removed the last consolidation from
126 // our map, we call ChildProcess::ReleaseProcess to release our previous 133 // our map, we call ChildProcess::ReleaseProcess to release our previous
127 // reference. 134 // reference.
128 void ReleaseBlobConsolidation(const std::string& uuid); 135 void ReleaseBlobConsolidation(const std::string& uuid);
129 136
130 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_; 137 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_;
131 std::map<std::string, std::unique_ptr<BlobConsolidation>> blob_storage_; 138 std::map<std::string, std::unique_ptr<BlobConsolidation>> blob_storage_;
132 139
133 DISALLOW_COPY_AND_ASSIGN(BlobTransportController); 140 DISALLOW_COPY_AND_ASSIGN(BlobTransportController);
134 }; 141 };
135 142
136 } // namespace content 143 } // namespace content
137 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_ 144 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/blob_storage/blob_transport_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698