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

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: 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 | « no previous file | cc/test/layer_tree_pixel_test.cc » ('j') | cc/test/test_delegating_output_surface.cc » ('J')
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..101bbf03463d6908f3b7bb7d7c9dd246f1288d76 100644
--- a/cc/test/fake_output_surface.cc
+++ b/cc/test/fake_output_surface.cc
@@ -46,24 +46,28 @@ 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_ = base::MakeUnique<CompositorFrame>(std::move(frame));
vmpstr 2016/07/19 23:27:01 nit: maybe just last_sent_frame_.reset(new Compos
danakj 2016/07/20 01:03:25 Sure.
+ ++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;
+ } else if (!context_provider()) {
+ // Unknown for software frames.
+ last_swap_rect_ = gfx::Rect();
enne (OOO) 2016/07/19 23:00:50 This is really empty and not the full rect?
danakj 2016/07/20 01:03:25 Software can partial swap, but it does it thru the
+ } else {
+ last_swap_rect_ = last_sent_frame_->gl_frame_data->sub_buffer_rect;
vmpstr 2016/07/19 23:27:02 tiny nit: can you swap else and the last else if?
danakj 2016/07/20 01:03:25 Done.
+ }
+ if (last_sent_frame_->delegated_frame_data || !context_provider()) {
if (last_sent_frame_->delegated_frame_data) {
vmpstr 2016/07/19 23:27:02 isn't 62-63 kind of corresponds to the if on line
danakj 2016/07/20 01:03:25 Yes, delegated frames can be hardware or software.
- 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 | « no previous file | cc/test/layer_tree_pixel_test.cc » ('j') | cc/test/test_delegating_output_surface.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698