Index: content/child/blob_storage/blob_transport_temporary_holder.h |
diff --git a/content/child/blob_storage/blob_transport_temporary_holder.h b/content/child/blob_storage/blob_transport_temporary_holder.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..753a7c8ce450c188b85bf3dadfeaa633f46d9800 |
--- /dev/null |
+++ b/content/child/blob_storage/blob_transport_temporary_holder.h |
@@ -0,0 +1,83 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_TEMPORARY_HOLDER_H_ |
+#define CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_TEMPORARY_HOLDER_H_ |
+ |
+#include <map> |
+#include <string> |
+#include <vector> |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/shared_memory.h" |
+#include "content/common/content_export.h" |
+#include "ipc/ipc_platform_file.h" |
+#include "storage/common/data_element.h" |
+ |
+template <typename T> |
+struct DefaultSingletonTraits; |
+ |
+namespace base { |
+class SingleThreadTaskRunner; |
+} |
+ |
+namespace storage { |
+struct BlobItemBytesRequest; |
+struct BlobItemBytesResponse; |
+} |
+ |
+namespace content { |
+ |
+class BlobConsolidation; |
+ |
+// This class holds all of the blob data that is in the process of being |
+// transported to the Browser process. It |
+// * Creates the blob item descriptions for the browser. |
+// * Includes shortcut data in the descriptions. |
+// * Generates responses to blob memory requests. |
+class CONTENT_EXPORT BlobTransportTemporaryHolder { |
+ public: |
+ enum class ResponsesStatus { |
+ UNKNOWN, |
+ BLOB_NOT_FOUND, |
+ INVALID_ITEM_INDEX, |
+ INVALID_DATA_RANGE, |
+ INVALID_ITEM, |
+ INVALID_HANDLE_INDEX, |
+ SHARED_MEMORY_MAP_FAILED, |
+ SUCCESS |
+ }; |
+ |
+ BlobTransportTemporaryHolder(); |
+ virtual ~BlobTransportTemporaryHolder(); |
+ |
+ // Gives the blob data to this class to hold. |
+ // Returns false if there already exists a blob with that uuid. |
michaeln
2015/10/21 02:22:24
The return value probably isn't needed, none of th
dmurph
2015/10/21 21:47:57
Ok. I'm going to keep it for Hold, so we can DCHE
michaeln
2015/10/22 21:10:22
Our style guide says "you should not handle DCHECK
|
+ bool HoldBlobConsolidation(const std::string& uuid, |
+ scoped_ptr<BlobConsolidation> consolidation); |
+ |
+ // Returns false if the blob doesn't exist. |
+ bool GetDescriptions(const std::string& uuid, |
+ size_t max_data_population, |
+ std::vector<storage::DataElement>* out); |
+ |
+ ResponsesStatus GetResponses( |
+ const std::string& uuid, |
+ const std::vector<storage::BlobItemBytesRequest>& requests, |
+ std::vector<base::SharedMemoryHandle>* memory_handles, |
+ const std::vector<IPC::PlatformFileForTransit>& file_handles, |
+ std::vector<storage::BlobItemBytesResponse>* output); |
+ |
+ void ReleaseBlob(const std::string& uuid); |
+ |
+ private: |
+ BlobConsolidation* GetConsolidation(const std::string& uuid); |
+ |
+ std::map<std::string, BlobConsolidation*> blob_storage_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BlobTransportTemporaryHolder); |
+}; |
+ |
+} // namespace content |
+#endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_TEMPORARY_HOLDER_H_ |