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

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

Issue 1414123002: [BlobAsync] Renderer support for blob file writing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blob-hookup
Patch Set: rebase Created 4 years, 8 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
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 <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h"
14 #include "base/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
15 #include "ipc/ipc_platform_file.h" 16 #include "ipc/ipc_platform_file.h"
16 #include "ipc/message_filter.h" 17 #include "ipc/message_filter.h"
17 #include "storage/common/blob_storage/blob_storage_constants.h" 18 #include "storage/common/blob_storage/blob_storage_constants.h"
18 19
20 namespace base {
21 class TaskRunner;
22 }
23
19 namespace IPC { 24 namespace IPC {
20 class Sender; 25 class Sender;
21 class Message; 26 class Message;
22 } 27 }
23 28
24 namespace storage { 29 namespace storage {
25 struct BlobItemBytesRequest; 30 struct BlobItemBytesRequest;
31 struct BlobItemBytesResponse;
26 } 32 }
27 33
28 namespace content { 34 namespace content {
29 35
30 // MessageFilter that handles Blob IPCs and delegates them to the 36 // MessageFilter that handles Blob IPCs and delegates them to the
31 // BlobTransportController singleton. Created on the render thread, and then 37 // BlobTransportController singleton. Created on the render thread, and then
32 // operated on by the IO thread. 38 // operated on by the IO thread.
33 class BlobMessageFilter : public IPC::MessageFilter { 39 class BlobMessageFilter : public IPC::MessageFilter {
34 public: 40 public:
35 BlobMessageFilter(); 41 BlobMessageFilter(scoped_refptr<base::TaskRunner> io_runner,
42 scoped_refptr<base::TaskRunner> file_runner);
36 43
44 void OnChannelClosing() override;
37 void OnFilterAdded(IPC::Sender* sender) override; 45 void OnFilterAdded(IPC::Sender* sender) override;
38 bool OnMessageReceived(const IPC::Message& message) override; 46 bool OnMessageReceived(const IPC::Message& message) override;
39 bool GetSupportedMessageClasses( 47 bool GetSupportedMessageClasses(
40 std::vector<uint32_t>* supported_message_classes) const override; 48 std::vector<uint32_t>* supported_message_classes) const override;
41 49
42 protected: 50 protected:
43 ~BlobMessageFilter() override; 51 ~BlobMessageFilter() override;
44 52
45 private: 53 private:
46 void OnRequestMemoryItem( 54 void OnRequestMemoryItem(
47 const std::string& uuid, 55 const std::string& uuid,
48 const std::vector<storage::BlobItemBytesRequest>& requests, 56 const std::vector<storage::BlobItemBytesRequest>& requests,
49 std::vector<base::SharedMemoryHandle> memory_handles, 57 std::vector<base::SharedMemoryHandle> memory_handles,
50 const std::vector<IPC::PlatformFileForTransit>& file_handles); 58 const std::vector<IPC::PlatformFileForTransit>& file_handles);
51 59
52 void OnCancelBuildingBlob(const std::string& uuid, 60 void OnCancelBuildingBlob(const std::string& uuid,
53 storage::IPCBlobCreationCancelCode code); 61 storage::IPCBlobCreationCancelCode code);
62 void SendResponses(
63 const std::string& uuid,
64 const std::vector<storage::BlobItemBytesResponse>& responses);
65
66 void SendCancel(const std::string& uuid,
67 storage::IPCBlobCreationCancelCode code);
54 68
55 void OnDoneBuildingBlob(const std::string& uuid); 69 void OnDoneBuildingBlob(const std::string& uuid);
56 70
57 IPC::Sender* sender_; 71 IPC::Sender* sender_;
72 scoped_refptr<base::TaskRunner> io_runner_;
73 scoped_refptr<base::TaskRunner> file_runner_;
58 74
59 DISALLOW_COPY_AND_ASSIGN(BlobMessageFilter); 75 DISALLOW_COPY_AND_ASSIGN(BlobMessageFilter);
60 }; 76 };
61 77
62 } // namespace content 78 } // namespace content
63 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_ 79 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_MESSAGE_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698