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

Side by Side Diff: storage/common/blob_storage/blob_item_bytes_request.h

Issue 1234813004: [BlobAsync] Asynchronous Blob Construction Final Patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blob-protocol-change
Patch Set: Comments Created 4 years, 9 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 STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_REQUEST_H_ 5 #ifndef STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_REQUEST_H_
6 #define STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_REQUEST_H_ 6 #define STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_REQUEST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <ostream> 10 #include <ostream>
11 11
12 #include "storage/common/blob_storage/blob_storage_constants.h" 12 #include "storage/common/blob_storage/blob_storage_constants.h"
13 #include "storage/common/storage_common_export.h" 13 #include "storage/common/storage_common_export.h"
14 14
15 namespace storage { 15 namespace storage {
16 16
17 // This class is serialized over IPC to request bytes from a blob item. 17 // This class is serialized over IPC to request bytes from a blob item.
18 // We are using uint32_t for the indexes
18 struct STORAGE_COMMON_EXPORT BlobItemBytesRequest { 19 struct STORAGE_COMMON_EXPORT BlobItemBytesRequest {
19 // Not using std::numeric_limits<T>::max() because of non-C++11 builds. 20 // Not using std::numeric_limits<T>::max() because of non-C++11 builds.
20 static const size_t kInvalidIndex = SIZE_MAX; 21 static const uint32_t kInvalidIndex = UINT32_MAX;
21 static const uint64_t kInvalidSize = UINT64_MAX; 22 static const uint64_t kInvalidSize = UINT64_MAX;
22 23
23 static BlobItemBytesRequest CreateIPCRequest(size_t request_number, 24 static BlobItemBytesRequest CreateIPCRequest(uint32_t request_number,
24 size_t renderer_item_index, 25 uint32_t renderer_item_index,
25 size_t renderer_item_offset, 26 uint64_t renderer_item_offset,
26 size_t size); 27 uint64_t size);
27 28
28 static BlobItemBytesRequest CreateSharedMemoryRequest( 29 static BlobItemBytesRequest CreateSharedMemoryRequest(
29 size_t request_number, 30 uint32_t request_number,
30 size_t renderer_item_index, 31 uint32_t renderer_item_index,
31 size_t renderer_item_offset, 32 uint64_t renderer_item_offset,
32 size_t size, 33 uint64_t size,
33 size_t handle_index, 34 uint32_t handle_index,
34 uint64_t handle_offset); 35 uint64_t handle_offset);
35 36
36 static BlobItemBytesRequest CreateFileRequest(size_t request_number, 37 static BlobItemBytesRequest CreateFileRequest(uint32_t request_number,
37 size_t renderer_item_index, 38 uint32_t renderer_item_index,
38 uint64_t renderer_item_offset, 39 uint64_t renderer_item_offset,
39 uint64_t size, 40 uint64_t size,
40 size_t handle_index, 41 uint32_t handle_index,
41 uint64_t handle_offset); 42 uint64_t handle_offset);
42 43
43 BlobItemBytesRequest(); 44 BlobItemBytesRequest();
44 BlobItemBytesRequest(size_t request_number, 45 BlobItemBytesRequest(uint32_t request_number,
45 IPCBlobItemRequestStrategy transport_strategy, 46 IPCBlobItemRequestStrategy transport_strategy,
46 size_t renderer_item_index, 47 uint32_t renderer_item_index,
47 uint64_t renderer_item_offset, 48 uint64_t renderer_item_offset,
48 uint64_t size, 49 uint64_t size,
49 size_t handle_index, 50 uint32_t handle_index,
50 uint64_t handle_offset); 51 uint64_t handle_offset);
51 ~BlobItemBytesRequest(); 52 ~BlobItemBytesRequest();
52 53
53 // The request number uniquely identifies the memory request. We can't use 54 // The request number uniquely identifies the memory request. We can't use
54 // the renderer item index or browser item index as there can be multiple 55 // the renderer item index or browser item index as there can be multiple
55 // requests for both (as segmentation boundaries can exist in both). 56 // requests for both (as segmentation boundaries can exist in both).
56 size_t request_number; 57 uint32_t request_number;
57 IPCBlobItemRequestStrategy transport_strategy; 58 IPCBlobItemRequestStrategy transport_strategy;
58 size_t renderer_item_index; 59 uint32_t renderer_item_index;
59 uint64_t renderer_item_offset; 60 uint64_t renderer_item_offset;
60 uint64_t size; 61 uint64_t size;
61 size_t handle_index; 62 uint32_t handle_index;
62 uint64_t handle_offset; 63 uint64_t handle_offset;
63 }; 64 };
64 65
65 STORAGE_COMMON_EXPORT void PrintTo(const BlobItemBytesRequest& request, 66 STORAGE_COMMON_EXPORT void PrintTo(const BlobItemBytesRequest& request,
66 std::ostream* os); 67 std::ostream* os);
67 68
68 STORAGE_COMMON_EXPORT bool operator==(const BlobItemBytesRequest& a, 69 STORAGE_COMMON_EXPORT bool operator==(const BlobItemBytesRequest& a,
69 const BlobItemBytesRequest& b); 70 const BlobItemBytesRequest& b);
70 71
71 STORAGE_COMMON_EXPORT bool operator!=(const BlobItemBytesRequest& a, 72 STORAGE_COMMON_EXPORT bool operator!=(const BlobItemBytesRequest& a,
72 const BlobItemBytesRequest& b); 73 const BlobItemBytesRequest& b);
73 74
74 } // namespace storage 75 } // namespace storage
75 76
76 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_REQUEST_H_ 77 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698