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

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

Issue 2485473003: Remove SurfaceFactory::Create and SurfaceFactory::Destroy (Closed)
Patch Set: SetPreviousFrame lint Created 4 years, 1 month 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 display_->renderer_for_testing()->SetEnlargePassTextureAmountForTesting( 104 display_->renderer_for_testing()->SetEnlargePassTextureAmountForTesting(
105 enlarge_pass_texture_amount_); 105 enlarge_pass_texture_amount_);
106 display_->SetVisible(true); 106 display_->SetVisible(true);
107 bound_ = true; 107 bound_ = true;
108 return true; 108 return true;
109 } 109 }
110 110
111 void TestCompositorFrameSink::DetachFromClient() { 111 void TestCompositorFrameSink::DetachFromClient() {
112 // Some tests make BindToClient fail on purpose. ^__^ 112 // Some tests make BindToClient fail on purpose. ^__^
113 if (bound_) { 113 if (bound_) {
114 if (delegated_local_frame_id_.is_valid()) 114 surface_factory_->Reset();
Fady Samuel 2016/11/11 19:47:57 EvictFrame()
115 surface_factory_->Destroy(delegated_local_frame_id_);
116 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_); 115 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_);
117 surface_manager_->InvalidateFrameSinkId(frame_sink_id_); 116 surface_manager_->InvalidateFrameSinkId(frame_sink_id_);
118 display_ = nullptr; 117 display_ = nullptr;
119 bound_ = false; 118 bound_ = false;
120 } 119 }
121 surface_factory_ = nullptr; 120 surface_factory_ = nullptr;
122 surface_id_allocator_ = nullptr; 121 surface_id_allocator_ = nullptr;
123 surface_manager_ = nullptr; 122 surface_manager_ = nullptr;
124 test_client_ = nullptr; 123 test_client_ = nullptr;
125 CompositorFrameSink::DetachFromClient(); 124 CompositorFrameSink::DetachFromClient();
126 } 125 }
127 126
128 void TestCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { 127 void TestCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) {
129 test_client_->DisplayReceivedCompositorFrame(frame); 128 test_client_->DisplayReceivedCompositorFrame(frame);
130 129
131 if (!delegated_local_frame_id_.is_valid()) { 130 if (!delegated_local_frame_id_.is_valid()) {
132 delegated_local_frame_id_ = surface_id_allocator_->GenerateId(); 131 delegated_local_frame_id_ = surface_id_allocator_->GenerateId();
133 surface_factory_->Create(delegated_local_frame_id_);
134 } 132 }
135 display_->SetLocalFrameId(delegated_local_frame_id_, 133 display_->SetLocalFrameId(delegated_local_frame_id_,
136 frame.metadata.device_scale_factor); 134 frame.metadata.device_scale_factor);
137 135
138 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); 136 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
139 display_->Resize(frame_size); 137 display_->Resize(frame_size);
140 138
141 bool synchronous = !display_->has_scheduler(); 139 bool synchronous = !display_->has_scheduler();
142 140
143 SurfaceFactory::DrawCallback draw_callback; 141 SurfaceFactory::DrawCallback draw_callback;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 bool will_draw_and_swap, 200 bool will_draw_and_swap,
203 const RenderPassList& render_passes) { 201 const RenderPassList& render_passes) {
204 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); 202 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes);
205 } 203 }
206 204
207 void TestCompositorFrameSink::DisplayDidDrawAndSwap() { 205 void TestCompositorFrameSink::DisplayDidDrawAndSwap() {
208 test_client_->DisplayDidDrawAndSwap(); 206 test_client_->DisplayDidDrawAndSwap();
209 } 207 }
210 208
211 } // namespace cc 209 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698