| 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 #ifndef CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ |
| 6 #define CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ | 6 #define CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 context_provider, TestContextProvider::CreateWorker())); | 39 context_provider, TestContextProvider::CreateWorker())); |
| 40 } | 40 } |
| 41 | 41 |
| 42 static std::unique_ptr<FakeCompositorFrameSink> Create3d( | 42 static std::unique_ptr<FakeCompositorFrameSink> Create3d( |
| 43 std::unique_ptr<TestWebGraphicsContext3D> context) { | 43 std::unique_ptr<TestWebGraphicsContext3D> context) { |
| 44 return base::WrapUnique(new FakeCompositorFrameSink( | 44 return base::WrapUnique(new FakeCompositorFrameSink( |
| 45 TestContextProvider::Create(std::move(context)), | 45 TestContextProvider::Create(std::move(context)), |
| 46 TestContextProvider::CreateWorker())); | 46 TestContextProvider::CreateWorker())); |
| 47 } | 47 } |
| 48 | 48 |
| 49 static std::unique_ptr<FakeCompositorFrameSink> |
| 50 Create3dForGpuRasterization() { |
| 51 auto context = TestWebGraphicsContext3D::Create(); |
| 52 context->set_gpu_rasterization(true); |
| 53 auto context_provider = TestContextProvider::Create(std::move(context)); |
| 54 return base::WrapUnique(new FakeCompositorFrameSink( |
| 55 std::move(context_provider), TestContextProvider::CreateWorker())); |
| 56 } |
| 57 |
| 49 static std::unique_ptr<FakeCompositorFrameSink> CreateSoftware() { | 58 static std::unique_ptr<FakeCompositorFrameSink> CreateSoftware() { |
| 50 return base::WrapUnique(new FakeCompositorFrameSink(nullptr, nullptr)); | 59 return base::WrapUnique(new FakeCompositorFrameSink(nullptr, nullptr)); |
| 51 } | 60 } |
| 52 | 61 |
| 53 // CompositorFrameSink implementation. | 62 // CompositorFrameSink implementation. |
| 54 void SubmitCompositorFrame(CompositorFrame frame) override; | 63 void SubmitCompositorFrame(CompositorFrame frame) override; |
| 55 void DetachFromClient() override; | 64 void DetachFromClient() override; |
| 56 | 65 |
| 57 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); } | 66 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); } |
| 58 size_t num_sent_frames() { return num_sent_frames_; } | 67 size_t num_sent_frames() { return num_sent_frames_; } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 86 | 95 |
| 87 private: | 96 private: |
| 88 void DidReceiveCompositorFrameAck(); | 97 void DidReceiveCompositorFrameAck(); |
| 89 | 98 |
| 90 base::WeakPtrFactory<FakeCompositorFrameSink> weak_ptr_factory_; | 99 base::WeakPtrFactory<FakeCompositorFrameSink> weak_ptr_factory_; |
| 91 }; | 100 }; |
| 92 | 101 |
| 93 } // namespace cc | 102 } // namespace cc |
| 94 | 103 |
| 95 #endif // CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ | 104 #endif // CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ |
| OLD | NEW |