OLD | NEW |
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> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
20 #include "base/memory/shared_memory_handle.h" | 20 #include "base/memory/shared_memory_handle.h" |
21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
22 #include "base/optional.h" | 22 #include "base/optional.h" |
23 #include "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
24 #include "ipc/ipc_platform_file.h" | 24 #include "ipc/ipc_platform_file.h" |
25 #include "storage/common/blob_storage/blob_storage_constants.h" | 25 #include "storage/common/blob_storage/blob_storage_constants.h" |
26 | 26 |
27 namespace base { | 27 namespace base { |
28 template <typename T> | 28 template <typename T> |
29 struct DefaultLazyInstanceTraits; | 29 struct LazyInstanceTraitsBase; |
30 class SingleThreadTaskRunner; | 30 class SingleThreadTaskRunner; |
31 class TaskRunner; | 31 class TaskRunner; |
32 } | 32 } |
33 | 33 |
34 namespace storage { | 34 namespace storage { |
35 class DataElement; | 35 class DataElement; |
36 struct BlobItemBytesRequest; | 36 struct BlobItemBytesRequest; |
37 struct BlobItemBytesResponse; | 37 struct BlobItemBytesResponse; |
38 } | 38 } |
39 | 39 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 bool IsTransporting(const std::string& uuid) { | 93 bool IsTransporting(const std::string& uuid) { |
94 return blob_storage_.find(uuid) != blob_storage_.end(); | 94 return blob_storage_.find(uuid) != blob_storage_.end(); |
95 } | 95 } |
96 | 96 |
97 // Invalidates all asynchronously running memory request handlers and clears | 97 // Invalidates all asynchronously running memory request handlers and clears |
98 // 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 |
99 // ChildProcess::ReleaseProcess to release our previous reference. | 99 // ChildProcess::ReleaseProcess to release our previous reference. |
100 void CancelAllBlobTransfers(); | 100 void CancelAllBlobTransfers(); |
101 | 101 |
102 private: | 102 private: |
103 friend struct base::DefaultLazyInstanceTraits<BlobTransportController>; | 103 friend struct base::LazyInstanceTraitsBase<BlobTransportController>; |
104 friend class BlobTransportControllerTest; | 104 friend class BlobTransportControllerTest; |
105 FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, Descriptions); | 105 FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, Descriptions); |
106 FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, Responses); | 106 FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, Responses); |
107 FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, SharedMemory); | 107 FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, SharedMemory); |
108 FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, Disk); | 108 FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, Disk); |
109 FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, ResponsesErrors); | 109 FRIEND_TEST_ALL_PREFIXES(BlobTransportControllerTest, ResponsesErrors); |
110 | 110 |
111 enum class ResponsesStatus { | 111 enum class ResponsesStatus { |
112 BLOB_NOT_FOUND, | 112 BLOB_NOT_FOUND, |
113 SHARED_MEMORY_MAP_FAILED, | 113 SHARED_MEMORY_MAP_FAILED, |
(...skipping 24 matching lines...) Expand all Loading... |
138 | 138 |
139 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_; | 139 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_; |
140 std::map<std::string, scoped_refptr<BlobConsolidation>> blob_storage_; | 140 std::map<std::string, scoped_refptr<BlobConsolidation>> blob_storage_; |
141 base::WeakPtrFactory<BlobTransportController> weak_factory_; | 141 base::WeakPtrFactory<BlobTransportController> weak_factory_; |
142 | 142 |
143 DISALLOW_COPY_AND_ASSIGN(BlobTransportController); | 143 DISALLOW_COPY_AND_ASSIGN(BlobTransportController); |
144 }; | 144 }; |
145 | 145 |
146 } // namespace content | 146 } // namespace content |
147 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_ | 147 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_CONTROLLER_H_ |
OLD | NEW |