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

Side by Side Diff: cc/ipc/copy_output_request_struct_traits.h

Issue 2670213006: Mojom structs for copy requests / results should map to unique_ptr (Closed)
Patch Set: c Created 3 years, 10 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
« no previous file with comments | « cc/ipc/copy_output_request.typemap ('k') | cc/ipc/copy_output_request_struct_traits.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 CC_IPC_COPY_OUTPUT_REQUEST_STRUCT_TRAITS_H_ 5 #ifndef CC_IPC_COPY_OUTPUT_REQUEST_STRUCT_TRAITS_H_
6 #define CC_IPC_COPY_OUTPUT_REQUEST_STRUCT_TRAITS_H_ 6 #define CC_IPC_COPY_OUTPUT_REQUEST_STRUCT_TRAITS_H_
7 7
8 #include "cc/ipc/copy_output_request.mojom-shared.h" 8 #include "cc/ipc/copy_output_request.mojom-shared.h"
9 #include "cc/ipc/texture_mailbox_struct_traits.h"
9 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
11 #include "mojo/common/common_custom_types_struct_traits.h"
12 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h"
10 13
11 namespace mojo { 14 namespace mojo {
12 15
13 template <> 16 template <>
14 struct StructTraits<cc::mojom::CopyOutputRequestDataView, 17 struct StructTraits<cc::mojom::CopyOutputRequestDataView,
15 cc::CopyOutputRequest> { 18 std::unique_ptr<cc::CopyOutputRequest>> {
16 static const base::Optional<base::UnguessableToken>& source( 19 static const base::Optional<base::UnguessableToken>& source(
17 const cc::CopyOutputRequest& request) { 20 const std::unique_ptr<cc::CopyOutputRequest>& request) {
18 return request.source_; 21 return request->source_;
19 } 22 }
20 23
21 static bool force_bitmap_result(const cc::CopyOutputRequest& request) { 24 static bool force_bitmap_result(
22 return request.force_bitmap_result_; 25 const std::unique_ptr<cc::CopyOutputRequest>& request) {
26 return request->force_bitmap_result_;
23 } 27 }
24 28
25 static const base::Optional<gfx::Rect>& area( 29 static const base::Optional<gfx::Rect>& area(
26 const cc::CopyOutputRequest& request) { 30 const std::unique_ptr<cc::CopyOutputRequest>& request) {
27 return request.area_; 31 return request->area_;
28 } 32 }
29 33
30 static const base::Optional<cc::TextureMailbox>& texture_mailbox( 34 static const base::Optional<cc::TextureMailbox>& texture_mailbox(
31 const cc::CopyOutputRequest& request) { 35 const std::unique_ptr<cc::CopyOutputRequest>& request) {
32 return request.texture_mailbox_; 36 return request->texture_mailbox_;
33 } 37 }
34 38
35 static bool Read(cc::mojom::CopyOutputRequestDataView data, 39 static bool Read(cc::mojom::CopyOutputRequestDataView data,
36 cc::CopyOutputRequest* out) { 40 std::unique_ptr<cc::CopyOutputRequest>* out_p);
37 out->force_bitmap_result_ = data.force_bitmap_result();
38 return data.ReadSource(&out->source_) && data.ReadArea(&out->area_) &&
39 data.ReadTextureMailbox(&out->texture_mailbox_);
40 }
41 }; 41 };
42 42
43 } // namespace mojo 43 } // namespace mojo
44 44
45 #endif // CC_IPC_COPY_OUTPUT_REQUEST_STRUCT_TRAITS_H_ 45 #endif // CC_IPC_COPY_OUTPUT_REQUEST_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « cc/ipc/copy_output_request.typemap ('k') | cc/ipc/copy_output_request_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698