Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / test / fake_compositor_dependencies.cc
blob045dcee17e8e734f1dfcb2675b062e5394e991e8
1 // Copyright 2014 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.
5 #include "content/test/fake_compositor_dependencies.h"
7 #include "base/single_thread_task_runner.h"
8 #include "base/thread_task_runner_handle.h"
9 #include "cc/test/fake_external_begin_frame_source.h"
10 #include "third_party/khronos/GLES2/gl2.h"
11 #include "ui/gfx/buffer_types.h"
13 namespace content {
15 FakeCompositorDependencies::FakeCompositorDependencies() {
18 FakeCompositorDependencies::~FakeCompositorDependencies() {
21 bool FakeCompositorDependencies::IsGpuRasterizationForced() {
22 return false;
25 bool FakeCompositorDependencies::IsGpuRasterizationEnabled() {
26 return false;
29 int FakeCompositorDependencies::GetGpuRasterizationMSAASampleCount() {
30 return 0;
33 bool FakeCompositorDependencies::IsLcdTextEnabled() {
34 return false;
37 bool FakeCompositorDependencies::IsDistanceFieldTextEnabled() {
38 return false;
41 bool FakeCompositorDependencies::IsZeroCopyEnabled() {
42 return true;
45 bool FakeCompositorDependencies::IsPersistentGpuMemoryBufferEnabled() {
46 return false;
49 bool FakeCompositorDependencies::IsElasticOverscrollEnabled() {
50 return false;
52 std::vector<unsigned> FakeCompositorDependencies::GetImageTextureTargets() {
53 return std::vector<unsigned>(static_cast<size_t>(gfx::BufferFormat::LAST) + 1,
54 GL_TEXTURE_2D);
57 scoped_refptr<base::SingleThreadTaskRunner>
58 FakeCompositorDependencies::GetCompositorMainThreadTaskRunner() {
59 return base::ThreadTaskRunnerHandle::Get();
62 scoped_refptr<base::SingleThreadTaskRunner>
63 FakeCompositorDependencies::GetCompositorImplThreadTaskRunner() {
64 return nullptr; // Currently never threaded compositing in unit tests.
67 cc::SharedBitmapManager* FakeCompositorDependencies::GetSharedBitmapManager() {
68 return &shared_bitmap_manager_;
71 gpu::GpuMemoryBufferManager*
72 FakeCompositorDependencies::GetGpuMemoryBufferManager() {
73 return &gpu_memory_buffer_manager_;
76 scheduler::RendererScheduler*
77 FakeCompositorDependencies::GetRendererScheduler() {
78 return &renderer_scheduler_;
81 cc::ContextProvider*
82 FakeCompositorDependencies::GetSharedMainThreadContextProvider() {
83 NOTREACHED();
84 return nullptr;
87 scoped_ptr<cc::BeginFrameSource>
88 FakeCompositorDependencies::CreateExternalBeginFrameSource(int routing_id) {
89 double refresh_rate = 200.0;
90 return make_scoped_ptr(new cc::FakeExternalBeginFrameSource(refresh_rate));
93 cc::TaskGraphRunner* FakeCompositorDependencies::GetTaskGraphRunner() {
94 return &task_graph_runner_;
97 bool FakeCompositorDependencies::IsGatherPixelRefsEnabled() {
98 return false;
101 bool FakeCompositorDependencies::IsThreadedAnimationEnabled() {
102 return true;
105 } // namespace content