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