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..1621d3238308036d10242f56370ae4f0da675006 |
--- /dev/null |
+++ b/content/child/blob_storage/blob_message_filter.h |
@@ -0,0 +1,68 @@ |
+// 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 <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 { |
+class BlobTransportController; |
+ |
+// This message filter forwards Blob IPCs to the BlobTransportController |
+// singleton. |
+// Invarients: There should only be one filter per renderer process, and it |
+// should live on the main renderer 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>* supported_message_classes) const override; |
+ |
+ void OnChannelClosing() 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_; |
+ BlobTransportController* controller_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BlobMessageFilter); |
+}; |
+ |
+} // namespace content |
+#endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ |