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

Side by Side Diff: cc/output/copy_output_request.h

Issue 2652343003: Replace source pointer in cc::CopyOutputRequest with a base::UnguessableToken (Closed)
Patch Set: c Created 3 years, 11 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 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"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/optional.h"
13 #include "base/unguessable_token.h"
12 #include "cc/base/cc_export.h" 14 #include "cc/base/cc_export.h"
13 #include "cc/resources/single_release_callback.h" 15 #include "cc/resources/single_release_callback.h"
14 #include "cc/resources/texture_mailbox.h" 16 #include "cc/resources/texture_mailbox.h"
15 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
16 18
17 class SkBitmap; 19 class SkBitmap;
18 20
19 namespace cc { 21 namespace cc {
20 class CopyOutputResult; 22 class CopyOutputResult;
21 23
(...skipping 14 matching lines...) Expand all
36 return base::WrapUnique(new CopyOutputRequest(true, result_callback)); 38 return base::WrapUnique(new CopyOutputRequest(true, result_callback));
37 } 39 }
38 static std::unique_ptr<CopyOutputRequest> CreateRelayRequest( 40 static std::unique_ptr<CopyOutputRequest> CreateRelayRequest(
39 const CopyOutputRequest& original_request, 41 const CopyOutputRequest& original_request,
40 const CopyOutputRequestCallback& result_callback); 42 const CopyOutputRequestCallback& result_callback);
41 43
42 ~CopyOutputRequest(); 44 ~CopyOutputRequest();
43 45
44 bool IsEmpty() const { return result_callback_.is_null(); } 46 bool IsEmpty() const { return result_callback_.is_null(); }
45 47
46 // Optionally specify the source of this copy request. If set when this copy 48 // Optionally specify the source of this copy request. If set when this copy
47 // request is submitted to a layer, a prior uncommitted copy request from the 49 // request is submitted to a layer, a prior uncommitted copy request from the
48 // same |source| will be aborted. 50 // same source will be aborted.
49 void set_source(void* source) { source_ = source; } 51 void set_source(base::UnguessableToken source) { source_ = source; }
Fady Samuel 2017/01/26 21:22:42 const base::UnguessableToken&
Saman Sami 2017/01/26 21:47:27 Done.
50 void* source() const { return source_; } 52 bool has_source() const { return source_.has_value(); }
53 base::UnguessableToken source() const { return *source_; }
Fady Samuel 2017/01/26 21:22:42 const base::UnguessableToken&
Saman Sami 2017/01/26 21:47:27 Done.
51 54
52 bool force_bitmap_result() const { return force_bitmap_result_; } 55 bool force_bitmap_result() const { return force_bitmap_result_; }
53 56
54 // By default copy requests copy the entire layer's subtree output. If an 57 // By default copy requests copy the entire layer's subtree output. If an
55 // area is given, then the intersection of this rect (in layer space) with 58 // area is given, then the intersection of this rect (in layer space) with
56 // the layer's subtree output will be returned. 59 // the layer's subtree output will be returned.
57 void set_area(const gfx::Rect& area) { 60 void set_area(const gfx::Rect& area) {
58 has_area_ = true; 61 has_area_ = true;
59 area_ = area; 62 area_ = area;
60 } 63 }
(...skipping 14 matching lines...) Expand all
75 const TextureMailbox& texture_mailbox, 78 const TextureMailbox& texture_mailbox,
76 std::unique_ptr<SingleReleaseCallback> release_callback); 79 std::unique_ptr<SingleReleaseCallback> release_callback);
77 80
78 void SendResult(std::unique_ptr<CopyOutputResult> result); 81 void SendResult(std::unique_ptr<CopyOutputResult> result);
79 82
80 private: 83 private:
81 CopyOutputRequest(); 84 CopyOutputRequest();
82 CopyOutputRequest(bool force_bitmap_result, 85 CopyOutputRequest(bool force_bitmap_result,
83 const CopyOutputRequestCallback& result_callback); 86 const CopyOutputRequestCallback& result_callback);
84 87
85 void* source_; 88 base::Optional<base::UnguessableToken> source_;
86 bool force_bitmap_result_; 89 bool force_bitmap_result_;
87 bool has_area_; 90 bool has_area_;
88 bool has_texture_mailbox_; 91 bool has_texture_mailbox_;
89 gfx::Rect area_; 92 gfx::Rect area_;
90 TextureMailbox texture_mailbox_; 93 TextureMailbox texture_mailbox_;
91 CopyOutputRequestCallback result_callback_; 94 CopyOutputRequestCallback result_callback_;
92 }; 95 };
93 96
94 } // namespace cc 97 } // namespace cc
95 98
96 #endif // CC_OUTPUT_COPY_OUTPUT_REQUEST_H_ 99 #endif // CC_OUTPUT_COPY_OUTPUT_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698