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/surfaces/surface_id_allocator.h" | 9 #include "cc/surfaces/surface_id_allocator.h" |
10 #include "cc/test/pixel_test_output_surface.h" | 10 #include "cc/test/pixel_test_output_surface.h" |
11 #include "cc/test/test_shared_bitmap_manager.h" | 11 #include "cc/test/test_shared_bitmap_manager.h" |
12 #include "ui/compositor/compositor_switches.h" | 12 #include "ui/compositor/compositor_switches.h" |
13 #include "ui/compositor/reflector.h" | 13 #include "ui/compositor/reflector.h" |
14 #include "ui/gl/gl_implementation.h" | 14 #include "ui/gl/gl_implementation.h" |
15 #include "ui/gl/gl_surface.h" | 15 #include "ui/gl/gl_surface.h" |
16 #include "webkit/common/gpu/context_provider_in_process.h" | 16 #include "webkit/common/gpu/context_provider_in_process.h" |
17 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" | 17 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" |
18 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 18 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 | 21 |
22 InProcessContextFactory::InProcessContextFactory() | 22 InProcessContextFactory::InProcessContextFactory() |
23 : shared_bitmap_manager_(new cc::TestSharedBitmapManager()), | 23 : next_surface_id_namespace_(1u) { |
24 next_surface_id_namespace_(1u) { | |
25 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) | 24 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) |
26 << "If running tests, ensure that main() is calling " | 25 << "If running tests, ensure that main() is calling " |
27 << "gfx::GLSurface::InitializeOneOffForTests()"; | 26 << "gfx::GLSurface::InitializeOneOffForTests()"; |
28 | 27 |
29 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
30 bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch( | 29 bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch( |
31 switches::kUIDisableThreadedCompositing); | 30 switches::kUIDisableThreadedCompositing); |
32 #else | 31 #else |
33 bool use_thread = false; | 32 bool use_thread = false; |
34 #endif | 33 #endif |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 shared_main_thread_contexts_ = NULL; | 87 shared_main_thread_contexts_ = NULL; |
89 | 88 |
90 return shared_main_thread_contexts_; | 89 return shared_main_thread_contexts_; |
91 } | 90 } |
92 | 91 |
93 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {} | 92 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {} |
94 | 93 |
95 bool InProcessContextFactory::DoesCreateTestContexts() { return false; } | 94 bool InProcessContextFactory::DoesCreateTestContexts() { return false; } |
96 | 95 |
97 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() { | 96 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() { |
98 return shared_bitmap_manager_.get(); | 97 return &shared_bitmap_manager_; |
| 98 } |
| 99 |
| 100 cc::GpuMemoryBufferManager* |
| 101 InProcessContextFactory::GetGpuMemoryBufferManager() { |
| 102 return &gpu_memory_buffer_manager_; |
99 } | 103 } |
100 | 104 |
101 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() { | 105 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() { |
102 if (!compositor_thread_) | 106 if (!compositor_thread_) |
103 return NULL; | 107 return NULL; |
104 return compositor_thread_->message_loop_proxy().get(); | 108 return compositor_thread_->message_loop_proxy().get(); |
105 } | 109 } |
106 | 110 |
107 scoped_ptr<cc::SurfaceIdAllocator> | 111 scoped_ptr<cc::SurfaceIdAllocator> |
108 InProcessContextFactory::CreateSurfaceIdAllocator() { | 112 InProcessContextFactory::CreateSurfaceIdAllocator() { |
109 return make_scoped_ptr( | 113 return make_scoped_ptr( |
110 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); | 114 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); |
111 } | 115 } |
112 | 116 |
113 } // namespace ui | 117 } // namespace ui |
OLD | NEW |