Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/compositor/test/fake_context_factory.h" | |
| 6 | |
| 7 #include "base/threading/thread_task_runner_handle.h" | |
| 8 #include "cc/output/compositor_frame.h" | |
| 9 #include "cc/output/compositor_frame_sink_client.h" | |
| 10 #include "cc/scheduler/begin_frame_source.h" | |
| 11 #include "cc/scheduler/delay_based_time_source.h" | |
| 12 #include "cc/test/fake_compositor_frame_sink.h" | |
| 13 | |
| 14 namespace ui { | |
| 15 | |
| 16 const cc::CompositorFrame& FakeContextFactory::GetLastCompositorFrame() const { | |
| 17 return *frame_sink_->last_sent_frame(); | |
| 18 } | |
| 19 | |
| 20 void FakeContextFactory::CreateCompositorFrameSink( | |
| 21 base::WeakPtr<ui::Compositor> compositor) { | |
| 22 auto frame_sink = cc::FakeCompositorFrameSink::Create3d(); | |
| 23 frame_sink_ = frame_sink.get(); | |
| 24 compositor->SetCompositorFrameSink(std::move(frame_sink)); | |
| 25 } | |
| 26 | |
| 27 scoped_refptr<cc::ContextProvider> | |
| 28 FakeContextFactory::SharedMainThreadContextProvider() { | |
| 29 return nullptr; | |
| 30 } | |
| 31 | |
| 32 void FakeContextFactory::RemoveCompositor(ui::Compositor* compositor) { | |
| 33 frame_sink_ = nullptr; | |
| 34 } | |
| 35 | |
| 36 bool FakeContextFactory::DoesCreateTestContexts() { | |
| 37 return true; | |
| 38 } | |
| 39 | |
| 40 uint32_t FakeContextFactory::GetImageTextureTarget(gfx::BufferFormat format, | |
| 41 gfx::BufferUsage usage) { | |
| 42 return GL_TEXTURE_2D; | |
| 43 } | |
| 44 | |
| 45 gpu::GpuMemoryBufferManager* FakeContextFactory::GetGpuMemoryBufferManager() { | |
| 46 return &gpu_memory_buffer_manager_; | |
| 47 } | |
| 48 | |
| 49 cc::TaskGraphRunner* FakeContextFactory::GetTaskGraphRunner() { | |
| 50 return &task_graph_runner_; | |
| 51 } | |
| 52 | |
| 53 void FakeContextFactory::AddObserver(ui::ContextFactoryObserver* observer) {} | |
|
danakj
2017/03/17 16:54:31
(you can leave the defn of empty methods in the he
sadrul
2017/03/17 18:59:14
Done.
| |
| 54 void FakeContextFactory::RemoveObserver(ui::ContextFactoryObserver* observer) {} | |
| 55 | |
| 56 } // namespace ui | |
| OLD | NEW |