Index: content/child/blob_storage/blob_message_filter.h |
diff --git a/content/child/blob_storage/blob_message_filter.h b/content/child/blob_storage/blob_message_filter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..26266658a22e301cc61aa3f27ec15198ed1a4d96 |
--- /dev/null |
+++ b/content/child/blob_storage/blob_message_filter.h |
@@ -0,0 +1,63 @@ |
+// 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_MESSAGE_FILTER_H_ |
+#define CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ |
+ |
+#include <stddef.h> |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "base/macros.h" |
+#include "base/memory/shared_memory.h" |
+#include "ipc/ipc_platform_file.h" |
+#include "ipc/message_filter.h" |
+#include "storage/common/blob_storage/blob_storage_constants.h" |
+ |
+namespace IPC { |
+class Sender; |
+class Message; |
+} |
+ |
+namespace storage { |
+struct BlobItemBytesRequest; |
+} |
+ |
+namespace content { |
+ |
+// MessageFilter that handles Blob IPCs and delegates them to the |
+// BlobTransportController singleton. Created on the render thread, and then |
+// operated on by the IO thread. |
+class BlobMessageFilter : public IPC::MessageFilter { |
+ public: |
+ BlobMessageFilter(); |
+ |
+ void OnFilterAdded(IPC::Sender* sender) override; |
+ bool OnMessageReceived(const IPC::Message& message) override; |
+ bool GetSupportedMessageClasses( |
+ std::vector<uint32_t>* supported_message_classes) const override; |
+ |
+ protected: |
+ ~BlobMessageFilter() override; |
+ |
+ private: |
+ void OnRequestMemoryItem( |
+ const std::string& uuid, |
+ const std::vector<storage::BlobItemBytesRequest>& requests, |
+ std::vector<base::SharedMemoryHandle> memory_handles, |
+ const std::vector<IPC::PlatformFileForTransit>& file_handles); |
+ |
+ void OnCancelBuildingBlob(const std::string& uuid, |
+ storage::IPCBlobCreationCancelCode code); |
+ |
+ void OnDoneBuildingBlob(const std::string& uuid); |
+ |
+ IPC::Sender* sender_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BlobMessageFilter); |
+}; |
+ |
+} // namespace content |
+#endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ |