OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/fake_compositor_frame_sink.h" | 5 #include "cc/test/fake_compositor_frame_sink.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "cc/output/compositor_frame_sink_client.h" | 9 #include "cc/output/compositor_frame_sink_client.h" |
10 #include "cc/resources/returned_resource.h" | 10 #include "cc/resources/returned_resource.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 void FakeCompositorFrameSink::SwapBuffers(CompositorFrame frame) { | 24 void FakeCompositorFrameSink::SwapBuffers(CompositorFrame frame) { |
25 ReturnResourcesHeldByParent(); | 25 ReturnResourcesHeldByParent(); |
26 | 26 |
27 last_sent_frame_.reset(new CompositorFrame(std::move(frame))); | 27 last_sent_frame_.reset(new CompositorFrame(std::move(frame))); |
28 ++num_sent_frames_; | 28 ++num_sent_frames_; |
29 | 29 |
30 if (last_sent_frame_->delegated_frame_data) { | 30 if (last_sent_frame_->delegated_frame_data) { |
31 auto* frame_data = last_sent_frame_->delegated_frame_data.get(); | 31 auto* frame_data = last_sent_frame_->delegated_frame_data.get(); |
32 last_swap_rect_ = frame_data->render_pass_list.back()->damage_rect; | 32 last_swap_rect_ = frame_data->render_pass_list.back()->damage_rect; |
33 last_swap_rect_valid_ = true; | 33 last_swap_rect_valid_ = true; |
34 } else if (context_provider()) { | |
35 last_swap_rect_ = last_sent_frame_->gl_frame_data->sub_buffer_rect; | |
36 last_swap_rect_valid_ = true; | |
37 } else { | 34 } else { |
38 // Unknown for direct software frames. | 35 // Unknown for direct software frames. |
danakj
2016/10/04 21:58:40
There's no direct frame here anymore, can you remo
kylechar
2016/10/05 13:45:54
Done.
| |
39 last_swap_rect_ = gfx::Rect(); | 36 last_swap_rect_ = gfx::Rect(); |
40 last_swap_rect_valid_ = false; | 37 last_swap_rect_valid_ = false; |
41 } | 38 } |
42 | 39 |
43 if (last_sent_frame_->delegated_frame_data || !context_provider()) { | 40 if (last_sent_frame_->delegated_frame_data || !context_provider()) { |
44 if (last_sent_frame_->delegated_frame_data) { | 41 if (last_sent_frame_->delegated_frame_data) { |
45 auto* frame_data = last_sent_frame_->delegated_frame_data.get(); | 42 auto* frame_data = last_sent_frame_->delegated_frame_data.get(); |
46 resources_held_by_parent_.insert(resources_held_by_parent_.end(), | 43 resources_held_by_parent_.insert(resources_held_by_parent_.end(), |
47 frame_data->resource_list.begin(), | 44 frame_data->resource_list.begin(), |
48 frame_data->resource_list.end()); | 45 frame_data->resource_list.end()); |
(...skipping 24 matching lines...) Expand all Loading... | |
73 // Return the last frame's resources immediately. | 70 // Return the last frame's resources immediately. |
74 ReturnedResourceArray resources; | 71 ReturnedResourceArray resources; |
75 for (const auto& resource : resources_held_by_parent_) | 72 for (const auto& resource : resources_held_by_parent_) |
76 resources.push_back(resource.ToReturnedResource()); | 73 resources.push_back(resource.ToReturnedResource()); |
77 resources_held_by_parent_.clear(); | 74 resources_held_by_parent_.clear(); |
78 client_->ReclaimResources(resources); | 75 client_->ReclaimResources(resources); |
79 } | 76 } |
80 } | 77 } |
81 | 78 |
82 } // namespace cc | 79 } // namespace cc |
OLD | NEW |