| 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/output_test_common.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 | 16 |
| 16 FakeOutputSurface::FakeOutputSurface( | 17 FakeOutputSurface::FakeOutputSurface( |
| 17 scoped_refptr<ContextProvider> context_provider, | 18 scoped_refptr<ContextProvider> context_provider, |
| 18 bool delegated_rendering) | 19 bool delegated_rendering) |
| 19 : OutputSurface(context_provider), | 20 : OutputSurface(context_provider), |
| 20 client_(NULL), | 21 client_(NULL), |
| 21 num_sent_frames_(0), | 22 num_sent_frames_(0), |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 if (enable) { | 92 if (enable) { |
| 92 base::MessageLoop::current()->PostDelayedTask( | 93 base::MessageLoop::current()->PostDelayedTask( |
| 93 FROM_HERE, | 94 FROM_HERE, |
| 94 base::Bind(&FakeOutputSurface::OnBeginFrame, | 95 base::Bind(&FakeOutputSurface::OnBeginFrame, |
| 95 fake_weak_ptr_factory_.GetWeakPtr()), | 96 fake_weak_ptr_factory_.GetWeakPtr()), |
| 96 base::TimeDelta::FromMilliseconds(16)); | 97 base::TimeDelta::FromMilliseconds(16)); |
| 97 } | 98 } |
| 98 } | 99 } |
| 99 | 100 |
| 100 void FakeOutputSurface::OnBeginFrame() { | 101 void FakeOutputSurface::OnBeginFrame() { |
| 101 client_->BeginFrame(BeginFrameArgs::CreateForTesting()); | 102 client_->BeginFrame(BeginFrameArgsCreateForTesting()); |
| 102 } | 103 } |
| 103 | 104 |
| 104 | 105 |
| 105 bool FakeOutputSurface::ForcedDrawToSoftwareDevice() const { | 106 bool FakeOutputSurface::ForcedDrawToSoftwareDevice() const { |
| 106 return forced_draw_to_software_device_; | 107 return forced_draw_to_software_device_; |
| 107 } | 108 } |
| 108 | 109 |
| 109 bool FakeOutputSurface::BindToClient(OutputSurfaceClient* client) { | 110 bool FakeOutputSurface::BindToClient(OutputSurfaceClient* client) { |
| 110 if (OutputSurface::BindToClient(client)) { | 111 if (OutputSurface::BindToClient(client)) { |
| 111 client_ = client; | 112 client_ = client; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 141 bool FakeOutputSurface::HasExternalStencilTest() const { | 142 bool FakeOutputSurface::HasExternalStencilTest() const { |
| 142 return has_external_stencil_test_; | 143 return has_external_stencil_test_; |
| 143 } | 144 } |
| 144 | 145 |
| 145 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( | 146 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( |
| 146 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { | 147 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { |
| 147 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); | 148 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); |
| 148 } | 149 } |
| 149 | 150 |
| 150 } // namespace cc | 151 } // namespace cc |
| OLD | NEW |