Chromium Code Reviews| 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) | 38 IPC_MESSAGE_HANDLER(BlobStorageMsg_SendBlobStatus, OnBlobStatus) |
|
michaeln
2016/08/15 22:44:43
maybe call this OnBlobFinalStatus here and through
dmurph
2016/08/19 00:18:32
Done.
| |
| 39 IPC_MESSAGE_HANDLER(BlobStorageMsg_DoneBuildingBlob, OnDoneBuildingBlob) | |
| 40 IPC_MESSAGE_UNHANDLED(handled = false) | 39 IPC_MESSAGE_UNHANDLED(handled = false) |
| 41 IPC_END_MESSAGE_MAP() | 40 IPC_END_MESSAGE_MAP() |
| 42 return handled; | 41 return handled; |
| 43 } | 42 } |
| 44 | 43 |
| 45 bool BlobMessageFilter::GetSupportedMessageClasses( | 44 bool BlobMessageFilter::GetSupportedMessageClasses( |
| 46 std::vector<uint32_t>* supported_message_classes) const { | 45 std::vector<uint32_t>* supported_message_classes) const { |
| 47 supported_message_classes->push_back(BlobMsgStart); | 46 supported_message_classes->push_back(BlobMsgStart); |
| 48 return true; | 47 return true; |
| 49 } | 48 } |
| 50 | 49 |
| 51 void BlobMessageFilter::OnRequestMemoryItem( | 50 void BlobMessageFilter::OnRequestMemoryItem( |
| 52 const std::string& uuid, | 51 const std::string& uuid, |
| 53 const std::vector<storage::BlobItemBytesRequest>& requests, | 52 const std::vector<storage::BlobItemBytesRequest>& requests, |
| 54 std::vector<base::SharedMemoryHandle> memory_handles, | 53 std::vector<base::SharedMemoryHandle> memory_handles, |
| 55 const std::vector<IPC::PlatformFileForTransit>& file_handles) { | 54 const std::vector<IPC::PlatformFileForTransit>& file_handles) { |
| 56 BlobTransportController::GetInstance()->OnMemoryRequest( | 55 BlobTransportController::GetInstance()->OnMemoryRequest( |
| 57 uuid, requests, &memory_handles, file_handles, file_runner_.get(), | 56 uuid, requests, &memory_handles, file_handles, file_runner_.get(), |
| 58 sender_); | 57 sender_); |
| 59 } | 58 } |
| 60 | 59 |
| 61 void BlobMessageFilter::OnCancelBuildingBlob( | 60 void BlobMessageFilter::OnBlobStatus(const std::string& uuid, |
| 62 const std::string& uuid, | 61 storage::BlobStatus code) { |
| 63 storage::IPCBlobCreationCancelCode code) { | 62 BlobTransportController::GetInstance()->OnBlobStatus(uuid, code); |
| 64 BlobTransportController::GetInstance()->OnCancel(uuid, code); | |
| 65 } | |
| 66 | |
| 67 void BlobMessageFilter::OnDoneBuildingBlob(const std::string& uuid) { | |
| 68 BlobTransportController::GetInstance()->OnDone(uuid); | |
| 69 } | 63 } |
| 70 | 64 |
| 71 } // namespace content | 65 } // namespace content |
| OLD | NEW |