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_MESSAGE_FILTER_H_ |
| 6 #define CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/shared_memory.h" |
| 13 #include "ipc/ipc_platform_file.h" |
| 14 #include "ipc/message_filter.h" |
| 15 #include "storage/common/blob_storage/blob_storage_constants.h" |
| 16 |
| 17 namespace IPC { |
| 18 class Sender; |
| 19 class Message; |
| 20 } |
| 21 |
| 22 namespace storage { |
| 23 struct BlobItemBytesRequest; |
| 24 } |
| 25 |
| 26 namespace content { |
| 27 class BlobTransportController; |
| 28 |
| 29 // This message filter forwards Blob IPCs to the BlobTransportController |
| 30 // singleton. |
| 31 // Invarients: There should only be one filter per renderer process, and it |
| 32 // should live on the main renderer thread. |
| 33 class BlobMessageFilter : public IPC::MessageFilter { |
| 34 public: |
| 35 BlobMessageFilter(); |
| 36 |
| 37 void OnFilterAdded(IPC::Sender* sender) override; |
| 38 |
| 39 bool OnMessageReceived(const IPC::Message& message) override; |
| 40 |
| 41 bool GetSupportedMessageClasses( |
| 42 std::vector<uint32>* supported_message_classes) const override; |
| 43 |
| 44 void OnChannelClosing() override; |
| 45 |
| 46 protected: |
| 47 ~BlobMessageFilter() override; |
| 48 |
| 49 private: |
| 50 void OnRequestMemoryItem( |
| 51 const std::string& uuid, |
| 52 const std::vector<storage::BlobItemBytesRequest>& requests, |
| 53 std::vector<base::SharedMemoryHandle> memory_handles, |
| 54 const std::vector<IPC::PlatformFileForTransit>& file_handles); |
| 55 |
| 56 void OnCancelBuildingBlob(const std::string& uuid, |
| 57 storage::IPCBlobCreationCancelCode code); |
| 58 |
| 59 void OnDoneBuildingBlob(const std::string& uuid); |
| 60 |
| 61 IPC::Sender* sender_; |
| 62 BlobTransportController* controller_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(BlobMessageFilter); |
| 65 }; |
| 66 |
| 67 } // namespace content |
| 68 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ |
OLD | NEW |