OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // IPC messages for HTML5 Blob and Stream. | 5 // IPC messages for HTML5 Blob and Stream. |
6 // Multiply-included message file, hence no include guard. | 6 // Multiply-included message file, hence no include guard. |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include "base/memory/shared_memory.h" |
10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
11 #include "content/public/common/common_param_traits.h" | 12 #include "content/public/common/common_param_traits.h" |
12 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
| 14 #include "ipc/ipc_message_utils.h" |
| 15 #include "ipc/ipc_param_traits.h" |
| 16 #include "ipc/ipc_platform_file.h" |
| 17 #include "storage/common/blob_storage/blob_item_bytes_request.h" |
| 18 #include "storage/common/blob_storage/blob_item_bytes_response.h" |
| 19 #include "storage/common/blob_storage/blob_storage_constants.h" |
13 #include "storage/common/data_element.h" | 20 #include "storage/common/data_element.h" |
14 | 21 |
15 #undef IPC_MESSAGE_EXPORT | 22 #undef IPC_MESSAGE_EXPORT |
16 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | 23 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
17 #define IPC_MESSAGE_START BlobMsgStart | 24 #define IPC_MESSAGE_START BlobMsgStart |
18 | 25 |
| 26 // Trait definitions for async blob transport messages. |
| 27 |
| 28 IPC_ENUM_TRAITS_MAX_VALUE(storage::IPCBlobItemRequestStrategy, |
| 29 storage::IPCBlobItemRequestStrategy::LAST) |
| 30 IPC_ENUM_TRAITS_MAX_VALUE(storage::IPCBlobCreationCancelCode, |
| 31 storage::IPCBlobCreationCancelCode::LAST) |
| 32 |
| 33 IPC_STRUCT_TRAITS_BEGIN(storage::BlobItemBytesRequest) |
| 34 IPC_STRUCT_TRAITS_MEMBER(request_number) |
| 35 IPC_STRUCT_TRAITS_MEMBER(transport_strategy) |
| 36 IPC_STRUCT_TRAITS_MEMBER(renderer_item_index) |
| 37 IPC_STRUCT_TRAITS_MEMBER(renderer_item_offset) |
| 38 IPC_STRUCT_TRAITS_MEMBER(size) |
| 39 IPC_STRUCT_TRAITS_MEMBER(handle_index) |
| 40 IPC_STRUCT_TRAITS_MEMBER(handle_offset) |
| 41 IPC_STRUCT_TRAITS_END() |
| 42 |
| 43 IPC_STRUCT_TRAITS_BEGIN(storage::BlobItemBytesResponse) |
| 44 IPC_STRUCT_TRAITS_MEMBER(request_number) |
| 45 IPC_STRUCT_TRAITS_MEMBER(inline_data) |
| 46 IPC_STRUCT_TRAITS_MEMBER(time_file_modified) |
| 47 IPC_STRUCT_TRAITS_END() |
| 48 |
19 // Blob messages sent from the renderer to the browser. | 49 // Blob messages sent from the renderer to the browser. |
20 | 50 |
21 IPC_MESSAGE_CONTROL1(BlobHostMsg_StartBuilding, | 51 IPC_MESSAGE_CONTROL1(BlobHostMsg_StartBuilding, |
22 std::string /*uuid */) | 52 std::string /*uuid */) |
23 IPC_MESSAGE_CONTROL2(BlobHostMsg_AppendBlobDataItem, | 53 IPC_MESSAGE_CONTROL2(BlobHostMsg_AppendBlobDataItem, |
24 std::string /* uuid */, | 54 std::string /* uuid */, |
25 storage::DataElement) | 55 storage::DataElement) |
26 IPC_SYNC_MESSAGE_CONTROL3_0(BlobHostMsg_SyncAppendSharedMemory, | 56 IPC_SYNC_MESSAGE_CONTROL3_0(BlobHostMsg_SyncAppendSharedMemory, |
27 std::string /*uuid*/, | 57 std::string /*uuid*/, |
28 base::SharedMemoryHandle, | 58 base::SharedMemoryHandle, |
29 size_t /* buffer size */) | 59 size_t /* buffer size */) |
30 IPC_MESSAGE_CONTROL2(BlobHostMsg_FinishBuilding, | 60 IPC_MESSAGE_CONTROL2(BlobHostMsg_FinishBuilding, |
31 std::string /* uuid */, | 61 std::string /* uuid */, |
32 std::string /* content_type */) | 62 std::string /* content_type */) |
33 | 63 |
| 64 // ******** NEW ASYNC BLOB TRANSPORT MESSAGES ********* |
| 65 // This message is to tell the browser that we will be building a blob. |
| 66 IPC_MESSAGE_CONTROL3(BlobStorageMsg_RegisterBlobUUID, |
| 67 std::string /* uuid */, |
| 68 std::string /* content_type */, |
| 69 std::string /* content_disposition */); |
| 70 |
| 71 // The DataElements are used to: |
| 72 // * describe & transport non-memory resources (blobs, files, etc) |
| 73 // * describe the size of memory items |
| 74 // * 'shortcut' transport the memory up to the IPC limit so the browser can use |
| 75 // it if it's not currently full. |
| 76 // See https://bit.ly/BlobStorageRefactor |
| 77 IPC_MESSAGE_CONTROL2(BlobStorageMsg_StartBuildingBlob, |
| 78 std::string /* uuid */, |
| 79 std::vector<storage::DataElement> /* item_descriptions */); |
| 80 |
| 81 IPC_MESSAGE_CONTROL4( |
| 82 BlobStorageMsg_RequestMemoryItem, |
| 83 std::string /* uuid */, |
| 84 std::vector<storage::BlobItemBytesRequest> /* requests */, |
| 85 std::vector<base::SharedMemoryHandle> /* memory_handles */, |
| 86 std::vector<IPC::PlatformFileForTransit> /* file_handles */); |
| 87 |
| 88 IPC_MESSAGE_CONTROL2( |
| 89 BlobStorageMsg_MemoryItemResponse, |
| 90 std::string /* uuid */, |
| 91 std::vector<storage::BlobItemBytesResponse> /* responses */); |
| 92 |
| 93 IPC_MESSAGE_CONTROL2(BlobStorageMsg_CancelBuildingBlob, |
| 94 std::string /* uuid */, |
| 95 storage::IPCBlobCreationCancelCode /* code */); |
| 96 |
| 97 IPC_MESSAGE_CONTROL1(BlobStorageMsg_DoneBuildingBlob, std::string /* uuid */); |
| 98 |
34 IPC_MESSAGE_CONTROL1(BlobHostMsg_IncrementRefCount, | 99 IPC_MESSAGE_CONTROL1(BlobHostMsg_IncrementRefCount, |
35 std::string /* uuid */) | 100 std::string /* uuid */) |
36 IPC_MESSAGE_CONTROL1(BlobHostMsg_DecrementRefCount, | 101 IPC_MESSAGE_CONTROL1(BlobHostMsg_DecrementRefCount, |
37 std::string /* uuid */) | 102 std::string /* uuid */) |
38 IPC_MESSAGE_CONTROL2(BlobHostMsg_RegisterPublicURL, | 103 IPC_MESSAGE_CONTROL2(BlobHostMsg_RegisterPublicURL, |
39 GURL, | 104 GURL, |
40 std::string /* uuid */) | 105 std::string /* uuid */) |
41 IPC_MESSAGE_CONTROL1(BlobHostMsg_RevokePublicURL, | 106 IPC_MESSAGE_CONTROL1(BlobHostMsg_RevokePublicURL, |
42 GURL) | 107 GURL) |
43 | 108 |
(...skipping 28 matching lines...) Expand all Loading... |
72 GURL /* url */) | 137 GURL /* url */) |
73 | 138 |
74 // Creates a new stream that's a clone of an existing src stream. | 139 // Creates a new stream that's a clone of an existing src stream. |
75 IPC_MESSAGE_CONTROL2(StreamHostMsg_Clone, | 140 IPC_MESSAGE_CONTROL2(StreamHostMsg_Clone, |
76 GURL /* url */, | 141 GURL /* url */, |
77 GURL /* src_url */) | 142 GURL /* src_url */) |
78 | 143 |
79 // Removes a stream. | 144 // Removes a stream. |
80 IPC_MESSAGE_CONTROL1(StreamHostMsg_Remove, | 145 IPC_MESSAGE_CONTROL1(StreamHostMsg_Remove, |
81 GURL /* url */) | 146 GURL /* url */) |
OLD | NEW |