| 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 : OutputSurface(context_provider, worker_context_provider), |
| 22 client_(NULL), | 22 client_(NULL), |
| 23 num_sent_frames_(0), | 23 num_sent_frames_(0), |
| 24 has_external_stencil_test_(false), | 24 has_external_stencil_test_(false), |
| 25 suspended_for_recycle_(false), | 25 suspended_for_recycle_(false), |
| 26 framebuffer_(0) { | 26 framebuffer_(0), |
| 27 overlay_candidate_validator_(nullptr) { |
| 27 if (delegated_rendering) { | 28 if (delegated_rendering) { |
| 28 capabilities_.delegated_rendering = true; | 29 capabilities_.delegated_rendering = true; |
| 29 capabilities_.max_frames_pending = 1; | 30 capabilities_.max_frames_pending = 1; |
| 30 } | 31 } |
| 31 } | 32 } |
| 32 | 33 |
| 33 FakeOutputSurface::FakeOutputSurface( | 34 FakeOutputSurface::FakeOutputSurface( |
| 34 scoped_refptr<ContextProvider> context_provider, | 35 scoped_refptr<ContextProvider> context_provider, |
| 35 bool delegated_rendering) | 36 bool delegated_rendering) |
| 36 : OutputSurface(context_provider), | 37 : OutputSurface(context_provider), |
| 37 client_(NULL), | 38 client_(NULL), |
| 38 num_sent_frames_(0), | 39 num_sent_frames_(0), |
| 39 has_external_stencil_test_(false), | 40 has_external_stencil_test_(false), |
| 40 suspended_for_recycle_(false), | 41 suspended_for_recycle_(false), |
| 41 framebuffer_(0) { | 42 framebuffer_(0), |
| 43 overlay_candidate_validator_(nullptr) { |
| 42 if (delegated_rendering) { | 44 if (delegated_rendering) { |
| 43 capabilities_.delegated_rendering = true; | 45 capabilities_.delegated_rendering = true; |
| 44 capabilities_.max_frames_pending = 1; | 46 capabilities_.max_frames_pending = 1; |
| 45 } | 47 } |
| 46 } | 48 } |
| 47 | 49 |
| 48 FakeOutputSurface::FakeOutputSurface( | 50 FakeOutputSurface::FakeOutputSurface( |
| 49 scoped_ptr<SoftwareOutputDevice> software_device, | 51 scoped_ptr<SoftwareOutputDevice> software_device, |
| 50 bool delegated_rendering) | 52 bool delegated_rendering) |
| 51 : OutputSurface(software_device.Pass()), | 53 : OutputSurface(software_device.Pass()), |
| 52 client_(NULL), | 54 client_(NULL), |
| 53 num_sent_frames_(0), | 55 num_sent_frames_(0), |
| 54 has_external_stencil_test_(false), | 56 has_external_stencil_test_(false), |
| 55 suspended_for_recycle_(false), | 57 suspended_for_recycle_(false), |
| 56 framebuffer_(0) { | 58 framebuffer_(0), |
| 59 overlay_candidate_validator_(nullptr) { |
| 57 if (delegated_rendering) { | 60 if (delegated_rendering) { |
| 58 capabilities_.delegated_rendering = true; | 61 capabilities_.delegated_rendering = true; |
| 59 capabilities_.max_frames_pending = 1; | 62 capabilities_.max_frames_pending = 1; |
| 60 } | 63 } |
| 61 } | 64 } |
| 62 | 65 |
| 63 FakeOutputSurface::FakeOutputSurface( | 66 FakeOutputSurface::FakeOutputSurface( |
| 64 scoped_refptr<ContextProvider> context_provider, | 67 scoped_refptr<ContextProvider> context_provider, |
| 65 scoped_ptr<SoftwareOutputDevice> software_device, | 68 scoped_ptr<SoftwareOutputDevice> software_device, |
| 66 bool delegated_rendering) | 69 bool delegated_rendering) |
| 67 : OutputSurface(context_provider, software_device.Pass()), | 70 : OutputSurface(context_provider, software_device.Pass()), |
| 68 client_(NULL), | 71 client_(NULL), |
| 69 num_sent_frames_(0), | 72 num_sent_frames_(0), |
| 70 has_external_stencil_test_(false), | 73 has_external_stencil_test_(false), |
| 71 suspended_for_recycle_(false), | 74 suspended_for_recycle_(false), |
| 72 framebuffer_(0) { | 75 framebuffer_(0), |
| 76 overlay_candidate_validator_(nullptr) { |
| 73 if (delegated_rendering) { | 77 if (delegated_rendering) { |
| 74 capabilities_.delegated_rendering = true; | 78 capabilities_.delegated_rendering = true; |
| 75 capabilities_.max_frames_pending = 1; | 79 capabilities_.max_frames_pending = 1; |
| 76 } | 80 } |
| 77 } | 81 } |
| 78 | 82 |
| 79 FakeOutputSurface::~FakeOutputSurface() {} | 83 FakeOutputSurface::~FakeOutputSurface() {} |
| 80 | 84 |
| 81 void FakeOutputSurface::SwapBuffers(CompositorFrame* frame) { | 85 void FakeOutputSurface::SwapBuffers(CompositorFrame* frame) { |
| 82 if (frame->delegated_frame_data || !context_provider()) { | 86 if (frame->delegated_frame_data || !context_provider()) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 144 } |
| 141 | 145 |
| 142 bool FakeOutputSurface::HasExternalStencilTest() const { | 146 bool FakeOutputSurface::HasExternalStencilTest() const { |
| 143 return has_external_stencil_test_; | 147 return has_external_stencil_test_; |
| 144 } | 148 } |
| 145 | 149 |
| 146 bool FakeOutputSurface::SurfaceIsSuspendForRecycle() const { | 150 bool FakeOutputSurface::SurfaceIsSuspendForRecycle() const { |
| 147 return suspended_for_recycle_; | 151 return suspended_for_recycle_; |
| 148 } | 152 } |
| 149 | 153 |
| 154 OverlayCandidateValidator* FakeOutputSurface::GetOverlayCandidateValidator() |
| 155 const { |
| 156 return overlay_candidate_validator_; |
| 157 } |
| 158 |
| 150 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( | 159 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( |
| 151 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { | 160 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { |
| 152 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); | 161 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); |
| 153 } | 162 } |
| 154 | 163 |
| 155 } // namespace cc | 164 } // namespace cc |
| OLD | NEW |