| 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()) { | 22 : shared_bitmap_manager_(new cc::TestSharedBitmapManager()) { |
| 23 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); | 23 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) |
| 24 << "If running tests, ensure that main() is calling " |
| 25 << "gfx::GLSurface::InitializeOneOffForTests()"; |
| 26 |
| 24 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
| 25 bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch( | 28 bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch( |
| 26 switches::kUIDisableThreadedCompositing); | 29 switches::kUIDisableThreadedCompositing); |
| 27 #else | 30 #else |
| 28 bool use_thread = false; | 31 bool use_thread = false; |
| 29 #endif | 32 #endif |
| 30 if (use_thread) { | 33 if (use_thread) { |
| 31 compositor_thread_.reset(new base::Thread("Browser Compositor")); | 34 compositor_thread_.reset(new base::Thread("Browser Compositor")); |
| 32 compositor_thread_->Start(); | 35 compositor_thread_->Start(); |
| 33 } | 36 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 return shared_bitmap_manager_.get(); | 96 return shared_bitmap_manager_.get(); |
| 94 } | 97 } |
| 95 | 98 |
| 96 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() { | 99 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() { |
| 97 if (!compositor_thread_) | 100 if (!compositor_thread_) |
| 98 return NULL; | 101 return NULL; |
| 99 return compositor_thread_->message_loop_proxy(); | 102 return compositor_thread_->message_loop_proxy(); |
| 100 } | 103 } |
| 101 | 104 |
| 102 } // namespace ui | 105 } // namespace ui |
| OLD | NEW |