| 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_output_surface.h" | 5 #include "cc/test/fake_output_surface.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/output_surface_client.h" | 9 #include "cc/output/output_surface_client.h" |
| 10 #include "cc/resources/returned_resource.h" | 10 #include "cc/resources/returned_resource.h" |
| 11 #include "cc/test/begin_frame_args_test.h" | 11 #include "cc/test/begin_frame_args_test.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 FakeOutputSurface::FakeOutputSurface( | 16 FakeOutputSurface::FakeOutputSurface( |
| 17 scoped_refptr<ContextProvider> context_provider, | 17 scoped_refptr<ContextProvider> context_provider) |
| 18 scoped_refptr<ContextProvider> worker_context_provider, | 18 : OutputSurface(std::move(context_provider)) {} |
| 19 bool delegated_rendering) | |
| 20 : FakeOutputSurface(std::move(context_provider), | |
| 21 std::move(worker_context_provider), | |
| 22 nullptr, | |
| 23 delegated_rendering) {} | |
| 24 | 19 |
| 25 FakeOutputSurface::FakeOutputSurface( | 20 FakeOutputSurface::FakeOutputSurface( |
| 26 scoped_refptr<ContextProvider> context_provider, | 21 std::unique_ptr<SoftwareOutputDevice> software_device) |
| 27 scoped_refptr<ContextProvider> worker_context_provider, | 22 : OutputSurface(std::move(software_device)) {} |
| 28 std::unique_ptr<SoftwareOutputDevice> software_device, | |
| 29 bool delegated_rendering) | |
| 30 : OutputSurface(std::move(context_provider), | |
| 31 std::move(worker_context_provider), | |
| 32 std::move(software_device)) { | |
| 33 capabilities_.delegated_rendering = false; | |
| 34 } | |
| 35 | 23 |
| 36 FakeOutputSurface::~FakeOutputSurface() = default; | 24 FakeOutputSurface::~FakeOutputSurface() = default; |
| 37 | 25 |
| 38 void FakeOutputSurface::SwapBuffers(CompositorFrame frame) { | 26 void FakeOutputSurface::SwapBuffers(CompositorFrame frame) { |
| 39 ReturnResourcesHeldByParent(); | 27 ReturnResourcesHeldByParent(); |
| 40 | 28 |
| 41 last_sent_frame_.reset(new CompositorFrame(std::move(frame))); | 29 last_sent_frame_.reset(new CompositorFrame(std::move(frame))); |
| 42 ++num_sent_frames_; | 30 ++num_sent_frames_; |
| 43 | 31 |
| 44 if (last_sent_frame_->delegated_frame_data) { | 32 if (last_sent_frame_->delegated_frame_data) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Return the last frame's resources immediately. | 104 // Return the last frame's resources immediately. |
| 117 ReturnedResourceArray resources; | 105 ReturnedResourceArray resources; |
| 118 for (const auto& resource : resources_held_by_parent_) | 106 for (const auto& resource : resources_held_by_parent_) |
| 119 resources.push_back(resource.ToReturnedResource()); | 107 resources.push_back(resource.ToReturnedResource()); |
| 120 resources_held_by_parent_.clear(); | 108 resources_held_by_parent_.clear(); |
| 121 client_->ReclaimResources(resources); | 109 client_->ReclaimResources(resources); |
| 122 } | 110 } |
| 123 } | 111 } |
| 124 | 112 |
| 125 } // namespace cc | 113 } // namespace cc |
| OLD | NEW |