Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: content/child/blob_storage/blob_message_filter.cc

Issue 1292523002: [BlobAsync] Patch 3: Renderer Classes & Logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@async2
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #include "content/child/blob_storage/blob_message_filter.h"
6
7 #include "content/child/blob_storage/blob_transport_controller.h"
8 #include "content/child/thread_safe_sender.h"
9 #include "content/child/worker_task_runner.h"
10 #include "content/common/blob_storage/blob_storage_messages.h"
11 #include "ipc/ipc_message.h"
12 #include "ipc/ipc_sender.h"
13 #include "storage/common/blob_storage/blob_item_bytes_request.h"
14
15 namespace content {
16
17 BlobMessageFilter::BlobMessageFilter()
18 : IPC::MessageFilter(),
19 sender_(nullptr),
20 controller_(BlobTransportController::GetInstance()) {}
21
22 BlobMessageFilter::~BlobMessageFilter() {}
23
24 void BlobMessageFilter::OnFilterAdded(IPC::Sender* sender) {
25 sender_ = sender;
26 }
27
28 bool BlobMessageFilter::OnMessageReceived(const IPC::Message& message) {
29 DCHECK_EQ(0, WorkerTaskRunner::Instance()->CurrentWorkerId());
30 bool handled = true;
31 IPC_BEGIN_MESSAGE_MAP(BlobMessageFilter, message)
32 IPC_MESSAGE_HANDLER(BlobStorageMsg_RequestMemoryItem, OnRequestMemoryItem)
33 IPC_MESSAGE_HANDLER(BlobStorageMsg_CancelBuildingBlob, OnCancelBuildingBlob)
34 IPC_MESSAGE_HANDLER(BlobStorageMsg_DoneBuildingBlob, OnDoneBuildingBlob)
35 IPC_MESSAGE_UNHANDLED(handled = false)
36 IPC_END_MESSAGE_MAP()
37 return handled;
38 }
39
40 bool BlobMessageFilter::GetSupportedMessageClasses(
41 std::vector<uint32>* supported_message_classes) const {
42 supported_message_classes->push_back(BlobMsgStart);
43 return true;
44 }
45
46 void BlobMessageFilter::OnChannelClosing() {
47 controller_->OnChannelClose();
48 }
49
50 void BlobMessageFilter::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 DCHECK_EQ(0, WorkerTaskRunner::Instance()->CurrentWorkerId());
56 controller_->OnMemoryRequest(uuid, requests, &memory_handles, file_handles,
57 sender_);
58 }
59 void BlobMessageFilter::OnCancelBuildingBlob(
60 const std::string& uuid,
61 storage::IPCBlobCreationCancelCode code) {
62 DCHECK_EQ(0, WorkerTaskRunner::Instance()->CurrentWorkerId());
63 controller_->OnCancel(uuid, code);
64 }
65
66 void BlobMessageFilter::OnDoneBuildingBlob(const std::string& uuid) {
67 DCHECK_EQ(0, WorkerTaskRunner::Instance()->CurrentWorkerId());
68 controller_->OnDone(uuid);
69 }
70
71 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698