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