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

Side by Side Diff: cc/test/test_compositor_frame_sink.cc

Issue 2425923003: Replaced is_null() with is_valid in SurfaceId and related classes. (Closed)
Patch Set: Removed added printf statements; LocalFrameId::is_valid() no longer checks if nonce is 0. Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "cc/test/test_compositor_frame_sink.h" 5 #include "cc/test/test_compositor_frame_sink.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "cc/output/begin_frame_args.h" 10 #include "cc/output/begin_frame_args.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 display_->renderer_for_testing()->SetEnlargePassTextureAmountForTesting( 97 display_->renderer_for_testing()->SetEnlargePassTextureAmountForTesting(
98 enlarge_pass_texture_amount_); 98 enlarge_pass_texture_amount_);
99 display_->SetVisible(true); 99 display_->SetVisible(true);
100 bound_ = true; 100 bound_ = true;
101 return true; 101 return true;
102 } 102 }
103 103
104 void TestCompositorFrameSink::DetachFromClient() { 104 void TestCompositorFrameSink::DetachFromClient() {
105 // Some tests make BindToClient fail on purpose. ^__^ 105 // Some tests make BindToClient fail on purpose. ^__^
106 if (bound_) { 106 if (bound_) {
107 if (!delegated_local_frame_id_.is_null()) 107 if (delegated_local_frame_id_.is_valid())
108 surface_factory_->Destroy(delegated_local_frame_id_); 108 surface_factory_->Destroy(delegated_local_frame_id_);
109 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_); 109 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_);
110 surface_manager_->InvalidateFrameSinkId(frame_sink_id_); 110 surface_manager_->InvalidateFrameSinkId(frame_sink_id_);
111 bound_ = false; 111 bound_ = false;
112 } 112 }
113 display_ = nullptr; 113 display_ = nullptr;
114 surface_factory_ = nullptr; 114 surface_factory_ = nullptr;
115 surface_id_allocator_ = nullptr; 115 surface_id_allocator_ = nullptr;
116 surface_manager_ = nullptr; 116 surface_manager_ = nullptr;
117 CompositorFrameSink::DetachFromClient(); 117 CompositorFrameSink::DetachFromClient();
118 } 118 }
119 119
120 void TestCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { 120 void TestCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) {
121 if (test_client_) 121 if (test_client_)
122 test_client_->DisplayReceivedCompositorFrame(frame); 122 test_client_->DisplayReceivedCompositorFrame(frame);
123 123
124 if (delegated_local_frame_id_.is_null()) { 124 if (!delegated_local_frame_id_.is_valid()) {
125 delegated_local_frame_id_ = surface_id_allocator_->GenerateId(); 125 delegated_local_frame_id_ = surface_id_allocator_->GenerateId();
126 surface_factory_->Create(delegated_local_frame_id_); 126 surface_factory_->Create(delegated_local_frame_id_);
127 } 127 }
128 display_->SetSurfaceId(SurfaceId(frame_sink_id_, delegated_local_frame_id_), 128 display_->SetSurfaceId(SurfaceId(frame_sink_id_, delegated_local_frame_id_),
129 frame.metadata.device_scale_factor); 129 frame.metadata.device_scale_factor);
130 130
131 gfx::Size frame_size = 131 gfx::Size frame_size =
132 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); 132 frame.delegated_frame_data->render_pass_list.back()->output_rect.size();
133 display_->Resize(frame_size); 133 display_->Resize(frame_size);
134 134
(...skipping 29 matching lines...) Expand all
164 } 164 }
165 165
166 void TestCompositorFrameSink::DidDrawCallback() { 166 void TestCompositorFrameSink::DidDrawCallback() {
167 // This is to unthrottle the next frame, not actually a notice that drawing is 167 // This is to unthrottle the next frame, not actually a notice that drawing is
168 // done. 168 // done.
169 client_->DidReceiveCompositorFrameAck(); 169 client_->DidReceiveCompositorFrameAck();
170 } 170 }
171 171
172 void TestCompositorFrameSink::ForceReclaimResources() { 172 void TestCompositorFrameSink::ForceReclaimResources() {
173 if (capabilities_.can_force_reclaim_resources && 173 if (capabilities_.can_force_reclaim_resources &&
174 !delegated_local_frame_id_.is_null()) { 174 delegated_local_frame_id_.is_valid()) {
175 surface_factory_->SubmitCompositorFrame(delegated_local_frame_id_, 175 surface_factory_->SubmitCompositorFrame(delegated_local_frame_id_,
176 CompositorFrame(), 176 CompositorFrame(),
177 SurfaceFactory::DrawCallback()); 177 SurfaceFactory::DrawCallback());
178 } 178 }
179 } 179 }
180 180
181 void TestCompositorFrameSink::ReturnResources( 181 void TestCompositorFrameSink::ReturnResources(
182 const ReturnedResourceArray& resources) { 182 const ReturnedResourceArray& resources) {
183 client_->ReclaimResources(resources); 183 client_->ReclaimResources(resources);
184 } 184 }
(...skipping 13 matching lines...) Expand all
198 if (test_client_) 198 if (test_client_)
199 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); 199 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes);
200 } 200 }
201 201
202 void TestCompositorFrameSink::DisplayDidDrawAndSwap() { 202 void TestCompositorFrameSink::DisplayDidDrawAndSwap() {
203 if (test_client_) 203 if (test_client_)
204 test_client_->DisplayDidDrawAndSwap(); 204 test_client_->DisplayDidDrawAndSwap();
205 } 205 }
206 206
207 } // namespace cc 207 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698