| 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 scoped_refptr<ContextProvider> worker_context_provider, |
| 19 bool delegated_rendering) | 19 bool delegated_rendering) |
| 20 : FakeOutputSurface(std::move(context_provider), | 20 : FakeOutputSurface(std::move(context_provider), |
| 21 std::move(worker_context_provider), | 21 std::move(worker_context_provider), |
| 22 nullptr, | 22 nullptr, |
| 23 delegated_rendering) {} | 23 delegated_rendering) {} |
| 24 | 24 |
| 25 FakeOutputSurface::FakeOutputSurface( | 25 FakeOutputSurface::FakeOutputSurface( |
| 26 std::unique_ptr<SoftwareOutputDevice> software_device, | |
| 27 bool delegated_rendering) | |
| 28 : FakeOutputSurface(nullptr, | |
| 29 nullptr, | |
| 30 std::move(software_device), | |
| 31 delegated_rendering) {} | |
| 32 | |
| 33 FakeOutputSurface::FakeOutputSurface( | |
| 34 scoped_refptr<ContextProvider> context_provider, | 26 scoped_refptr<ContextProvider> context_provider, |
| 35 scoped_refptr<ContextProvider> worker_context_provider, | 27 scoped_refptr<ContextProvider> worker_context_provider, |
| 36 std::unique_ptr<SoftwareOutputDevice> software_device, | 28 std::unique_ptr<SoftwareOutputDevice> software_device, |
| 37 bool delegated_rendering) | 29 bool delegated_rendering) |
| 38 : OutputSurface(std::move(context_provider), | 30 : OutputSurface(std::move(context_provider), |
| 39 std::move(worker_context_provider), | 31 std::move(worker_context_provider), |
| 40 std::move(software_device)) { | 32 std::move(software_device)) { |
| 41 capabilities_.delegated_rendering = delegated_rendering; | 33 capabilities_.delegated_rendering = delegated_rendering; |
| 42 } | 34 } |
| 43 | 35 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } else { | 93 } else { |
| 102 return false; | 94 return false; |
| 103 } | 95 } |
| 104 } | 96 } |
| 105 | 97 |
| 106 void FakeOutputSurface::DetachFromClient() { | 98 void FakeOutputSurface::DetachFromClient() { |
| 107 ReturnResourcesHeldByParent(); | 99 ReturnResourcesHeldByParent(); |
| 108 OutputSurface::DetachFromClient(); | 100 OutputSurface::DetachFromClient(); |
| 109 } | 101 } |
| 110 | 102 |
| 111 void FakeOutputSurface::SetTreeActivationCallback( | |
| 112 const base::Closure& callback) { | |
| 113 DCHECK(client_); | |
| 114 client_->SetTreeActivationCallback(callback); | |
| 115 } | |
| 116 | |
| 117 bool FakeOutputSurface::HasExternalStencilTest() const { | 103 bool FakeOutputSurface::HasExternalStencilTest() const { |
| 118 return has_external_stencil_test_; | 104 return has_external_stencil_test_; |
| 119 } | 105 } |
| 120 | 106 |
| 121 bool FakeOutputSurface::SurfaceIsSuspendForRecycle() const { | 107 bool FakeOutputSurface::SurfaceIsSuspendForRecycle() const { |
| 122 return suspended_for_recycle_; | 108 return suspended_for_recycle_; |
| 123 } | 109 } |
| 124 | 110 |
| 125 OverlayCandidateValidator* FakeOutputSurface::GetOverlayCandidateValidator() | 111 OverlayCandidateValidator* FakeOutputSurface::GetOverlayCandidateValidator() |
| 126 const { | 112 const { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 139 // Return the last frame's resources immediately. | 125 // Return the last frame's resources immediately. |
| 140 ReturnedResourceArray resources; | 126 ReturnedResourceArray resources; |
| 141 for (const auto& resource : resources_held_by_parent_) | 127 for (const auto& resource : resources_held_by_parent_) |
| 142 resources.push_back(resource.ToReturnedResource()); | 128 resources.push_back(resource.ToReturnedResource()); |
| 143 resources_held_by_parent_.clear(); | 129 resources_held_by_parent_.clear(); |
| 144 client_->ReclaimResources(resources); | 130 client_->ReclaimResources(resources); |
| 145 } | 131 } |
| 146 } | 132 } |
| 147 | 133 |
| 148 } // namespace cc | 134 } // namespace cc |
| OLD | NEW |