OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ |
6 #define CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ | 6 #define CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | |
10 #include <string> | 11 #include <string> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | |
14 #include "base/memory/shared_memory.h" | 16 #include "base/memory/shared_memory.h" |
15 #include "ipc/ipc_platform_file.h" | 17 #include "ipc/ipc_platform_file.h" |
16 #include "ipc/message_filter.h" | 18 #include "ipc/message_filter.h" |
17 #include "storage/common/blob_storage/blob_storage_constants.h" | 19 #include "storage/common/blob_storage/blob_storage_constants.h" |
18 | 20 |
21 namespace base { | |
22 class TaskRunner; | |
23 } | |
24 | |
19 namespace IPC { | 25 namespace IPC { |
20 class Sender; | 26 class Sender; |
21 class Message; | 27 class Message; |
22 } | 28 } |
23 | 29 |
24 namespace storage { | 30 namespace storage { |
25 struct BlobItemBytesRequest; | 31 struct BlobItemBytesRequest; |
32 struct BlobItemBytesResponse; | |
26 } | 33 } |
27 | 34 |
28 namespace content { | 35 namespace content { |
29 | 36 |
30 // MessageFilter that handles Blob IPCs and delegates them to the | 37 // MessageFilter that handles Blob IPCs and delegates them to the |
31 // BlobTransportController singleton. Created on the render thread, and then | 38 // BlobTransportController singleton. Created on the render thread, and then |
32 // operated on by the IO thread. | 39 // operated on by the IO thread. |
33 class BlobMessageFilter : public IPC::MessageFilter { | 40 class BlobMessageFilter : public IPC::MessageFilter { |
34 public: | 41 public: |
35 BlobMessageFilter(); | 42 BlobMessageFilter(scoped_refptr<base::TaskRunner> io_runner, |
kinuko
2016/04/25 14:10:30
io_runner no longer used?
dmurph
2016/04/26 22:33:28
Nice catch, thanks
| |
43 scoped_refptr<base::TaskRunner> file_runner); | |
36 | 44 |
45 void OnChannelClosing() override; | |
37 void OnFilterAdded(IPC::Sender* sender) override; | 46 void OnFilterAdded(IPC::Sender* sender) override; |
38 bool OnMessageReceived(const IPC::Message& message) override; | 47 bool OnMessageReceived(const IPC::Message& message) override; |
39 bool GetSupportedMessageClasses( | 48 bool GetSupportedMessageClasses( |
40 std::vector<uint32_t>* supported_message_classes) const override; | 49 std::vector<uint32_t>* supported_message_classes) const override; |
41 | 50 |
42 protected: | 51 protected: |
43 ~BlobMessageFilter() override; | 52 ~BlobMessageFilter() override; |
44 | 53 |
45 private: | 54 private: |
46 void OnRequestMemoryItem( | 55 void OnRequestMemoryItem( |
47 const std::string& uuid, | 56 const std::string& uuid, |
48 const std::vector<storage::BlobItemBytesRequest>& requests, | 57 const std::vector<storage::BlobItemBytesRequest>& requests, |
49 std::vector<base::SharedMemoryHandle> memory_handles, | 58 std::vector<base::SharedMemoryHandle> memory_handles, |
50 const std::vector<IPC::PlatformFileForTransit>& file_handles); | 59 const std::vector<IPC::PlatformFileForTransit>& file_handles); |
51 | 60 |
52 void OnCancelBuildingBlob(const std::string& uuid, | 61 void OnCancelBuildingBlob(const std::string& uuid, |
53 storage::IPCBlobCreationCancelCode code); | 62 storage::IPCBlobCreationCancelCode code); |
54 | 63 |
55 void OnDoneBuildingBlob(const std::string& uuid); | 64 void OnDoneBuildingBlob(const std::string& uuid); |
56 | 65 |
57 IPC::Sender* sender_; | 66 IPC::Sender* sender_; |
67 scoped_refptr<base::TaskRunner> io_runner_; | |
68 scoped_refptr<base::TaskRunner> file_runner_; | |
58 | 69 |
59 DISALLOW_COPY_AND_ASSIGN(BlobMessageFilter); | 70 DISALLOW_COPY_AND_ASSIGN(BlobMessageFilter); |
60 }; | 71 }; |
61 | 72 |
62 } // namespace content | 73 } // namespace content |
63 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ | 74 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ |
OLD | NEW |