OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_TEMPORARY_HOLDER_H_ | |
6 #define CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_TEMPORARY_HOLDER_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/containers/hash_tables.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/memory/shared_memory.h" | |
14 #include "content/common/content_export.h" | |
15 #include "ipc/ipc_platform_file.h" | |
16 #include "storage/common/data_element.h" | |
17 | |
18 template <typename T> | |
19 struct DefaultSingletonTraits; | |
20 | |
21 namespace base { | |
22 class SingleThreadTaskRunner; | |
23 } | |
24 | |
25 namespace storage { | |
26 struct BlobItemBytesRequest; | |
27 struct BlobItemBytesResponse; | |
28 } | |
29 | |
30 namespace content { | |
31 | |
32 class BlobConsolidation; | |
33 | |
34 // This class holds all of the blob data that is in the process of being | |
35 // transported to the Browser process. It | |
36 // * Creates the blob item descriptions for the browser. | |
37 // * Includes shortcut data in the descriptions. | |
38 // * Generates responses to blob memory requests. | |
39 class CONTENT_EXPORT BlobTransportTemporaryHolder { | |
michaeln
2015/08/18 02:50:35
This class is mostly just a map. The GetDescriptio
dmurph
2015/10/07 00:32:36
As we discussed, I would prefer to keep all the lo
michaeln
2015/10/21 02:22:24
Maybe this for names?
BlobMessageFilter (just lik
| |
40 public: | |
41 enum class ResponsesStatus { | |
42 UNKNOWN, | |
43 BLOB_NOT_FOUND, | |
44 INVALID_ITEM_INDEX, | |
45 INVALID_DATA_RANGE, | |
46 INVALID_ITEM, | |
47 INVALID_HANDLE_INDEX, | |
48 SHARED_MEMORY_MAP_FAILED, | |
49 SUCCESS | |
50 }; | |
51 | |
52 BlobTransportTemporaryHolder(); | |
53 virtual ~BlobTransportTemporaryHolder(); | |
54 | |
55 // Gives the blob data to this class to hold. | |
56 // Returns false if there already exists a blob with that uuid. | |
57 bool HoldBlobConsolidation(const std::string& uuid, | |
58 scoped_ptr<BlobConsolidation> consolidation); | |
59 | |
60 // Returns false if the blob doesn't exist. | |
61 bool GetDescriptions(const std::string& uuid, | |
62 size_t max_data_population, | |
63 std::vector<storage::DataElement>* out); | |
64 | |
65 ResponsesStatus GetResponses( | |
66 const std::string& uuid, | |
67 const std::vector<storage::BlobItemBytesRequest>& requests, | |
68 std::vector<base::SharedMemoryHandle>* memory_handles, | |
69 const std::vector<IPC::PlatformFileForTransit>& file_handles, | |
70 std::vector<storage::BlobItemBytesResponse>* output); | |
71 | |
72 void ReleaseBlob(const std::string& uuid); | |
73 | |
74 private: | |
75 BlobConsolidation* GetConsolidation(const std::string& uuid); | |
76 | |
77 base::hash_map<std::string, BlobConsolidation*> blob_storage_; | |
michaeln
2015/08/18 02:50:35
mostly this map will be empty, maybe use a std::ma
dmurph
2015/10/07 00:32:36
Done.
| |
78 | |
79 DISALLOW_COPY_AND_ASSIGN(BlobTransportTemporaryHolder); | |
80 }; | |
81 | |
82 } // namespace content | |
83 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_TEMPORARY_HOLDER_H_ | |
OLD | NEW |