| 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/compositor_frame_ack.h" | 9 #include "cc/output/compositor_frame_ack.h" |
| 10 #include "cc/output/output_surface_client.h" | 10 #include "cc/output/output_surface_client.h" |
| 11 #include "cc/resources/returned_resource.h" | 11 #include "cc/resources/returned_resource.h" |
| 12 #include "cc/test/begin_frame_args_test.h" | 12 #include "cc/test/begin_frame_args_test.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 FakeOutputSurface::FakeOutputSurface( | 17 FakeOutputSurface::FakeOutputSurface( |
| 18 scoped_refptr<ContextProvider> context_provider, | 18 scoped_refptr<ContextProvider> context_provider, |
| 19 scoped_refptr<ContextProvider> worker_context_provider, | 19 scoped_refptr<ContextProvider> worker_context_provider, |
| 20 bool delegated_rendering) | 20 bool delegated_rendering) |
| 21 : OutputSurface(context_provider, worker_context_provider), | 21 : FakeOutputSurface(std::move(context_provider), |
| 22 client_(NULL), | 22 std::move(worker_context_provider), |
| 23 num_sent_frames_(0), | 23 nullptr, |
| 24 has_external_stencil_test_(false), | 24 delegated_rendering) {} |
| 25 suspended_for_recycle_(false), | |
| 26 framebuffer_(0), | |
| 27 overlay_candidate_validator_(nullptr) { | |
| 28 capabilities_.delegated_rendering = delegated_rendering; | |
| 29 } | |
| 30 | |
| 31 FakeOutputSurface::FakeOutputSurface( | |
| 32 scoped_refptr<ContextProvider> context_provider, | |
| 33 bool delegated_rendering) | |
| 34 : OutputSurface(context_provider), | |
| 35 client_(NULL), | |
| 36 num_sent_frames_(0), | |
| 37 has_external_stencil_test_(false), | |
| 38 suspended_for_recycle_(false), | |
| 39 framebuffer_(0), | |
| 40 overlay_candidate_validator_(nullptr) { | |
| 41 capabilities_.delegated_rendering = delegated_rendering; | |
| 42 } | |
| 43 | 25 |
| 44 FakeOutputSurface::FakeOutputSurface( | 26 FakeOutputSurface::FakeOutputSurface( |
| 45 std::unique_ptr<SoftwareOutputDevice> software_device, | 27 std::unique_ptr<SoftwareOutputDevice> software_device, |
| 46 bool delegated_rendering) | 28 bool delegated_rendering) |
| 47 : OutputSurface(std::move(software_device)), | 29 : FakeOutputSurface(nullptr, |
| 30 nullptr, |
| 31 std::move(software_device), |
| 32 delegated_rendering) {} |
| 33 |
| 34 FakeOutputSurface::FakeOutputSurface( |
| 35 scoped_refptr<ContextProvider> context_provider, |
| 36 scoped_refptr<ContextProvider> worker_context_provider, |
| 37 std::unique_ptr<SoftwareOutputDevice> software_device, |
| 38 bool delegated_rendering) |
| 39 : OutputSurface(std::move(context_provider), |
| 40 std::move(worker_context_provider), |
| 41 std::move(software_device)), |
| 48 client_(NULL), | 42 client_(NULL), |
| 49 num_sent_frames_(0), | 43 num_sent_frames_(0), |
| 50 has_external_stencil_test_(false), | 44 has_external_stencil_test_(false), |
| 51 suspended_for_recycle_(false), | |
| 52 framebuffer_(0), | |
| 53 overlay_candidate_validator_(nullptr) { | |
| 54 capabilities_.delegated_rendering = delegated_rendering; | |
| 55 } | |
| 56 | |
| 57 FakeOutputSurface::FakeOutputSurface( | |
| 58 scoped_refptr<ContextProvider> context_provider, | |
| 59 std::unique_ptr<SoftwareOutputDevice> software_device, | |
| 60 bool delegated_rendering) | |
| 61 : OutputSurface(context_provider, std::move(software_device)), | |
| 62 client_(NULL), | |
| 63 num_sent_frames_(0), | |
| 64 has_external_stencil_test_(false), | |
| 65 suspended_for_recycle_(false), | 45 suspended_for_recycle_(false), |
| 66 framebuffer_(0), | 46 framebuffer_(0), |
| 67 overlay_candidate_validator_(nullptr) { | 47 overlay_candidate_validator_(nullptr) { |
| 68 capabilities_.delegated_rendering = delegated_rendering; | 48 capabilities_.delegated_rendering = delegated_rendering; |
| 69 } | 49 } |
| 70 | 50 |
| 71 FakeOutputSurface::~FakeOutputSurface() {} | 51 FakeOutputSurface::~FakeOutputSurface() {} |
| 72 | 52 |
| 73 void FakeOutputSurface::SwapBuffers(CompositorFrame* frame) { | 53 void FakeOutputSurface::SwapBuffers(CompositorFrame* frame) { |
| 74 if (frame->delegated_frame_data || !context_provider()) { | 54 if (frame->delegated_frame_data || !context_provider()) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 const { | 123 const { |
| 144 return overlay_candidate_validator_; | 124 return overlay_candidate_validator_; |
| 145 } | 125 } |
| 146 | 126 |
| 147 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( | 127 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( |
| 148 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { | 128 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { |
| 149 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); | 129 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); |
| 150 } | 130 } |
| 151 | 131 |
| 152 } // namespace cc | 132 } // namespace cc |
| OLD | NEW |