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

Side by Side Diff: cc/output/copy_output_request.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/struct_traits_unittest.cc ('k') | cc/output/copy_output_result.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_OUTPUT_COPY_OUTPUT_REQUEST_H_ 5 #ifndef CC_OUTPUT_COPY_OUTPUT_REQUEST_H_
6 #define CC_OUTPUT_COPY_OUTPUT_REQUEST_H_ 6 #define CC_OUTPUT_COPY_OUTPUT_REQUEST_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 29 matching lines...) Expand all
40 return base::WrapUnique(new CopyOutputRequest(false, result_callback)); 40 return base::WrapUnique(new CopyOutputRequest(false, result_callback));
41 } 41 }
42 static std::unique_ptr<CopyOutputRequest> CreateBitmapRequest( 42 static std::unique_ptr<CopyOutputRequest> CreateBitmapRequest(
43 const CopyOutputRequestCallback& result_callback) { 43 const CopyOutputRequestCallback& result_callback) {
44 return base::WrapUnique(new CopyOutputRequest(true, result_callback)); 44 return base::WrapUnique(new CopyOutputRequest(true, result_callback));
45 } 45 }
46 static std::unique_ptr<CopyOutputRequest> CreateRelayRequest( 46 static std::unique_ptr<CopyOutputRequest> CreateRelayRequest(
47 const CopyOutputRequest& original_request, 47 const CopyOutputRequest& original_request,
48 const CopyOutputRequestCallback& result_callback); 48 const CopyOutputRequestCallback& result_callback);
49 49
50 CopyOutputRequest();
51
52 ~CopyOutputRequest(); 50 ~CopyOutputRequest();
53 51
54 bool IsEmpty() const { return result_callback_.is_null(); } 52 bool IsEmpty() const { return result_callback_.is_null(); }
55 53
56 // Optionally specify the source of this copy request. If set when this copy 54 // Optionally specify the source of this copy request. If set when this copy
57 // request is submitted to a layer, a prior uncommitted copy request from the 55 // request is submitted to a layer, a prior uncommitted copy request from the
58 // same source will be aborted. 56 // same source will be aborted.
59 void set_source(const base::UnguessableToken& source) { source_ = source; } 57 void set_source(const base::UnguessableToken& source) { source_ = source; }
60 bool has_source() const { return source_.has_value(); } 58 bool has_source() const { return source_.has_value(); }
61 const base::UnguessableToken& source() const { return *source_; } 59 const base::UnguessableToken& source() const { return *source_; }
(...skipping 18 matching lines...) Expand all
80 void SendBitmapResult(std::unique_ptr<SkBitmap> bitmap); 78 void SendBitmapResult(std::unique_ptr<SkBitmap> bitmap);
81 void SendTextureResult( 79 void SendTextureResult(
82 const gfx::Size& size, 80 const gfx::Size& size,
83 const TextureMailbox& texture_mailbox, 81 const TextureMailbox& texture_mailbox,
84 std::unique_ptr<SingleReleaseCallback> release_callback); 82 std::unique_ptr<SingleReleaseCallback> release_callback);
85 83
86 void SendResult(std::unique_ptr<CopyOutputResult> result); 84 void SendResult(std::unique_ptr<CopyOutputResult> result);
87 85
88 private: 86 private:
89 friend struct mojo::StructTraits<mojom::CopyOutputRequestDataView, 87 friend struct mojo::StructTraits<mojom::CopyOutputRequestDataView,
90 CopyOutputRequest>; 88 std::unique_ptr<CopyOutputRequest>>;
91 89
90 CopyOutputRequest();
92 CopyOutputRequest(bool force_bitmap_result, 91 CopyOutputRequest(bool force_bitmap_result,
93 const CopyOutputRequestCallback& result_callback); 92 const CopyOutputRequestCallback& result_callback);
94 93
95 base::Optional<base::UnguessableToken> source_; 94 base::Optional<base::UnguessableToken> source_;
96 bool force_bitmap_result_; 95 bool force_bitmap_result_;
97 base::Optional<gfx::Rect> area_; 96 base::Optional<gfx::Rect> area_;
98 base::Optional<TextureMailbox> texture_mailbox_; 97 base::Optional<TextureMailbox> texture_mailbox_;
99 CopyOutputRequestCallback result_callback_; 98 CopyOutputRequestCallback result_callback_;
99
100 DISALLOW_COPY_AND_ASSIGN(CopyOutputRequest);
100 }; 101 };
101 102
102 } // namespace cc 103 } // namespace cc
103 104
104 #endif // CC_OUTPUT_COPY_OUTPUT_REQUEST_H_ 105 #endif // CC_OUTPUT_COPY_OUTPUT_REQUEST_H_
OLDNEW
« no previous file with comments | « cc/ipc/struct_traits_unittest.cc ('k') | cc/output/copy_output_result.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698