OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "ui/compositor/test/in_process_context_factory.h" | 5 #include "ui/compositor/test/in_process_context_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "cc/output/output_surface.h" | 9 #include "cc/output/output_surface.h" |
10 #include "cc/test/test_shared_bitmap_manager.h" | 10 #include "cc/test/test_shared_bitmap_manager.h" |
11 #include "ui/compositor/compositor_switches.h" | 11 #include "ui/compositor/compositor_switches.h" |
12 #include "ui/compositor/reflector.h" | 12 #include "ui/compositor/reflector.h" |
13 #include "ui/gl/gl_implementation.h" | 13 #include "ui/gl/gl_implementation.h" |
14 #include "ui/gl/gl_surface.h" | 14 #include "ui/gl/gl_surface.h" |
15 #include "webkit/common/gpu/context_provider_in_process.h" | 15 #include "webkit/common/gpu/context_provider_in_process.h" |
16 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" | 16 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" |
17 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 17 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 | 20 |
21 InProcessContextFactory::InProcessContextFactory() | 21 InProcessContextFactory::InProcessContextFactory() { |
22 : shared_bitmap_manager_(new cc::TestSharedBitmapManager()) { | |
23 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) | 22 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) |
24 << "If running tests, ensure that main() is calling " | 23 << "If running tests, ensure that main() is calling " |
25 << "gfx::GLSurface::InitializeOneOffForTests()"; | 24 << "gfx::GLSurface::InitializeOneOffForTests()"; |
26 | 25 |
27 #if defined(OS_CHROMEOS) | 26 #if defined(OS_CHROMEOS) |
28 bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch( | 27 bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch( |
29 switches::kUIDisableThreadedCompositing); | 28 switches::kUIDisableThreadedCompositing); |
30 #else | 29 #else |
31 bool use_thread = false; | 30 bool use_thread = false; |
32 #endif | 31 #endif |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 shared_main_thread_contexts_ = NULL; | 85 shared_main_thread_contexts_ = NULL; |
87 | 86 |
88 return shared_main_thread_contexts_; | 87 return shared_main_thread_contexts_; |
89 } | 88 } |
90 | 89 |
91 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {} | 90 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {} |
92 | 91 |
93 bool InProcessContextFactory::DoesCreateTestContexts() { return false; } | 92 bool InProcessContextFactory::DoesCreateTestContexts() { return false; } |
94 | 93 |
95 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() { | 94 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() { |
96 return shared_bitmap_manager_.get(); | 95 return &shared_bitmap_manager_; |
| 96 } |
| 97 |
| 98 cc::GpuMemoryBufferManager* |
| 99 InProcessContextFactory::GetGpuMemoryBufferManager() { |
| 100 return &gpu_memory_buffer_manager_; |
97 } | 101 } |
98 | 102 |
99 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() { | 103 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() { |
100 if (!compositor_thread_) | 104 if (!compositor_thread_) |
101 return NULL; | 105 return NULL; |
102 return compositor_thread_->message_loop_proxy().get(); | 106 return compositor_thread_->message_loop_proxy().get(); |
103 } | 107 } |
104 | 108 |
105 } // namespace ui | 109 } // namespace ui |
OLD | NEW |