Chromium Code Reviews| 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..72d9106f64b98707c087bf6dca53c70be87ae646 |
| --- /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 <string> |
| +#include <vector> |
| + |
| +#include "base/containers/hash_tables.h" |
| +#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 { |
|
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
|
| + 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. |
| + 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); |
| + |
| + 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.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(BlobTransportTemporaryHolder); |
| +}; |
| + |
| +} // namespace content |
| +#endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_TRANSPORT_TEMPORARY_HOLDER_H_ |