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

Unified Diff: cc/test/fake_output_surface.cc

Issue 2161323002: cc: Make LayerTreeHostImpl unittests use a delegating output surface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: display-lthi-tests: . Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/fake_output_surface.h ('k') | cc/test/layer_tree_pixel_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/fake_output_surface.cc
diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc
index 9a10249e1f6178f3ba0f369f3f5d6cdc15c2b643..c867d6b65d2ae3d5ee6cbf3f061a41fab9c33195 100644
--- a/cc/test/fake_output_surface.cc
+++ b/cc/test/fake_output_surface.cc
@@ -46,24 +46,31 @@ FakeOutputSurface::~FakeOutputSurface() = default;
void FakeOutputSurface::SwapBuffers(CompositorFrame frame) {
ReturnResourcesHeldByParent();
- std::unique_ptr<CompositorFrame> frame_copy(new CompositorFrame);
- *frame_copy = std::move(frame);
- if (frame_copy->delegated_frame_data || !context_provider()) {
- last_sent_frame_ = std::move(frame_copy);
+ last_sent_frame_.reset(new CompositorFrame(std::move(frame)));
+ ++num_sent_frames_;
+
+ if (last_sent_frame_->delegated_frame_data) {
+ auto* frame_data = last_sent_frame_->delegated_frame_data.get();
+ last_swap_rect_ = frame_data->render_pass_list.back()->damage_rect;
+ last_swap_rect_valid_ = true;
+ } else if (context_provider()) {
+ last_swap_rect_ = last_sent_frame_->gl_frame_data->sub_buffer_rect;
+ last_swap_rect_valid_ = true;
+ } else {
+ // Unknown for direct software frames.
+ last_swap_rect_ = gfx::Rect();
+ last_swap_rect_valid_ = false;
+ }
+ if (last_sent_frame_->delegated_frame_data || !context_provider()) {
if (last_sent_frame_->delegated_frame_data) {
- resources_held_by_parent_.insert(
- resources_held_by_parent_.end(),
- last_sent_frame_->delegated_frame_data->resource_list.begin(),
- last_sent_frame_->delegated_frame_data->resource_list.end());
+ auto* frame_data = last_sent_frame_->delegated_frame_data.get();
+ resources_held_by_parent_.insert(resources_held_by_parent_.end(),
+ frame_data->resource_list.begin(),
+ frame_data->resource_list.end());
}
-
- ++num_sent_frames_;
- } else {
- last_swap_rect_ = frame_copy->gl_frame_data->sub_buffer_rect;
- last_sent_frame_ = std::move(frame_copy);
- ++num_sent_frames_;
}
+
PostSwapBuffersComplete();
}
« no previous file with comments | « cc/test/fake_output_surface.h ('k') | cc/test/layer_tree_pixel_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698