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 #include "content/child/blob_storage/blob_message_filter.h" | 5 #include "content/child/blob_storage/blob_message_filter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/task_runner.h" | 8 #include "base/task_runner.h" |
9 #include "content/child/blob_storage/blob_transport_controller.h" | 9 #include "content/child/blob_storage/blob_transport_controller.h" |
10 #include "content/child/thread_safe_sender.h" | 10 #include "content/child/thread_safe_sender.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 void BlobMessageFilter::OnChannelClosing() { | 29 void BlobMessageFilter::OnChannelClosing() { |
30 BlobTransportController::GetInstance()->CancelAllBlobTransfers(); | 30 BlobTransportController::GetInstance()->CancelAllBlobTransfers(); |
31 sender_ = nullptr; | 31 sender_ = nullptr; |
32 } | 32 } |
33 | 33 |
34 bool BlobMessageFilter::OnMessageReceived(const IPC::Message& message) { | 34 bool BlobMessageFilter::OnMessageReceived(const IPC::Message& message) { |
35 bool handled = true; | 35 bool handled = true; |
36 IPC_BEGIN_MESSAGE_MAP(BlobMessageFilter, message) | 36 IPC_BEGIN_MESSAGE_MAP(BlobMessageFilter, message) |
37 IPC_MESSAGE_HANDLER(BlobStorageMsg_RequestMemoryItem, OnRequestMemoryItem) | 37 IPC_MESSAGE_HANDLER(BlobStorageMsg_RequestMemoryItem, OnRequestMemoryItem) |
38 IPC_MESSAGE_HANDLER(BlobStorageMsg_CancelBuildingBlob, OnCancelBuildingBlob) | |
39 IPC_MESSAGE_HANDLER(BlobStorageMsg_DoneBuildingBlob, OnDoneBuildingBlob) | |
40 IPC_MESSAGE_UNHANDLED(handled = false) | 38 IPC_MESSAGE_UNHANDLED(handled = false) |
41 IPC_END_MESSAGE_MAP() | 39 IPC_END_MESSAGE_MAP() |
42 return handled; | 40 return handled; |
43 } | 41 } |
44 | 42 |
45 bool BlobMessageFilter::GetSupportedMessageClasses( | 43 bool BlobMessageFilter::GetSupportedMessageClasses( |
46 std::vector<uint32_t>* supported_message_classes) const { | 44 std::vector<uint32_t>* supported_message_classes) const { |
47 supported_message_classes->push_back(BlobMsgStart); | 45 supported_message_classes->push_back(BlobMsgStart); |
48 return true; | 46 return true; |
49 } | 47 } |
50 | 48 |
51 void BlobMessageFilter::OnRequestMemoryItem( | 49 void BlobMessageFilter::OnRequestMemoryItem( |
52 const std::string& uuid, | 50 const std::string& uuid, |
53 const std::vector<storage::BlobItemBytesRequest>& requests, | 51 const std::vector<storage::BlobItemBytesRequest>& requests, |
54 std::vector<base::SharedMemoryHandle> memory_handles, | 52 std::vector<base::SharedMemoryHandle> memory_handles, |
55 const std::vector<IPC::PlatformFileForTransit>& file_handles) { | 53 const std::vector<IPC::PlatformFileForTransit>& file_handles) { |
56 BlobTransportController::GetInstance()->OnMemoryRequest( | 54 BlobTransportController::GetInstance()->OnMemoryRequest( |
57 uuid, requests, &memory_handles, file_handles, file_runner_.get(), | 55 uuid, requests, &memory_handles, file_handles, file_runner_.get(), |
58 sender_); | 56 sender_); |
59 } | 57 } |
60 | 58 |
61 void BlobMessageFilter::OnCancelBuildingBlob( | |
62 const std::string& uuid, | |
63 storage::IPCBlobCreationCancelCode code) { | |
64 BlobTransportController::GetInstance()->OnCancel(uuid, code); | |
65 } | |
66 | |
67 void BlobMessageFilter::OnDoneBuildingBlob(const std::string& uuid) { | |
68 BlobTransportController::GetInstance()->OnDone(uuid); | |
69 } | |
70 | |
71 } // namespace content | 59 } // namespace content |
OLD | NEW |