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

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

Issue 2096493002: Make cc::CompositorFrames movable [Part 1 of 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix reflector Created 4 years, 6 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/pixel_test_delegating_output_surface.h" 5 #include "cc/test/pixel_test_delegating_output_surface.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 surface_id_allocator_->id_namespace()); 113 surface_id_allocator_->id_namespace());
114 114
115 display_ = nullptr; 115 display_ = nullptr;
116 surface_factory_ = nullptr; 116 surface_factory_ = nullptr;
117 surface_id_allocator_ = nullptr; 117 surface_id_allocator_ = nullptr;
118 surface_manager_ = nullptr; 118 surface_manager_ = nullptr;
119 weak_ptrs_.InvalidateWeakPtrs(); 119 weak_ptrs_.InvalidateWeakPtrs();
120 OutputSurface::DetachFromClient(); 120 OutputSurface::DetachFromClient();
121 } 121 }
122 122
123 void PixelTestDelegatingOutputSurface::SwapBuffers(CompositorFrame* frame) { 123 void PixelTestDelegatingOutputSurface::SwapBuffers(
124 std::unique_ptr<CompositorFrame> frame) {
124 client_->DidSwapBuffers(); 125 client_->DidSwapBuffers();
125 126
126 if (delegated_surface_id_.is_null()) { 127 if (delegated_surface_id_.is_null()) {
127 delegated_surface_id_ = surface_id_allocator_->GenerateId(); 128 delegated_surface_id_ = surface_id_allocator_->GenerateId();
128 surface_factory_->Create(delegated_surface_id_); 129 surface_factory_->Create(delegated_surface_id_);
129 } 130 }
130 display_->SetSurfaceId(delegated_surface_id_, 131 display_->SetSurfaceId(delegated_surface_id_,
131 frame->metadata.device_scale_factor); 132 frame->metadata.device_scale_factor);
132 133
133 gfx::Size frame_size = 134 gfx::Size frame_size =
134 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); 135 frame->delegated_frame_data->render_pass_list.back()->output_rect.size();
135 display_->Resize(frame_size); 136 display_->Resize(frame_size);
136 137
137 std::unique_ptr<CompositorFrame> my_frame(new CompositorFrame);
138 frame->AssignTo(my_frame.get());
139 surface_factory_->SubmitCompositorFrame( 138 surface_factory_->SubmitCompositorFrame(
140 delegated_surface_id_, std::move(my_frame), 139 delegated_surface_id_, std::move(frame),
141 base::Bind(&PixelTestDelegatingOutputSurface::DrawCallback, 140 base::Bind(&PixelTestDelegatingOutputSurface::DrawCallback,
142 weak_ptrs_.GetWeakPtr())); 141 weak_ptrs_.GetWeakPtr()));
143 142
144 if (synchronous_composite_) 143 if (synchronous_composite_)
145 display_->DrawAndSwap(); 144 display_->DrawAndSwap();
146 } 145 }
147 146
148 void PixelTestDelegatingOutputSurface::SetEnlargePassTextureAmount( 147 void PixelTestDelegatingOutputSurface::SetEnlargePassTextureAmount(
149 const gfx::Size& amount) { 148 const gfx::Size& amount) {
150 DCHECK(!HasClient()); 149 DCHECK(!HasClient());
(...skipping 28 matching lines...) Expand all
179 ack.resources = resources; 178 ack.resources = resources;
180 client_->ReclaimResources(&ack); 179 client_->ReclaimResources(&ack);
181 } 180 }
182 181
183 void PixelTestDelegatingOutputSurface::SetBeginFrameSource( 182 void PixelTestDelegatingOutputSurface::SetBeginFrameSource(
184 BeginFrameSource* begin_frame_source) { 183 BeginFrameSource* begin_frame_source) {
185 client_->SetBeginFrameSource(begin_frame_source); 184 client_->SetBeginFrameSource(begin_frame_source);
186 } 185 }
187 186
188 } // namespace cc 187 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698