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" |
| 8 #include "base/threading/thread.h" |
7 #include "cc/output/output_surface.h" | 9 #include "cc/output/output_surface.h" |
8 #include "cc/test/test_shared_bitmap_manager.h" | 10 #include "cc/test/test_shared_bitmap_manager.h" |
| 11 #include "ui/compositor/compositor_switches.h" |
9 #include "ui/compositor/reflector.h" | 12 #include "ui/compositor/reflector.h" |
10 #include "ui/gl/gl_implementation.h" | 13 #include "ui/gl/gl_implementation.h" |
11 #include "ui/gl/gl_surface.h" | 14 #include "ui/gl/gl_surface.h" |
12 #include "webkit/common/gpu/context_provider_in_process.h" | 15 #include "webkit/common/gpu/context_provider_in_process.h" |
13 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" | 16 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" |
14 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 17 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
15 | 18 |
16 namespace ui { | 19 namespace ui { |
17 | 20 |
18 InProcessContextFactory::InProcessContextFactory() | 21 InProcessContextFactory::InProcessContextFactory() |
19 : shared_bitmap_manager_(new cc::TestSharedBitmapManager()) { | 22 : shared_bitmap_manager_(new cc::TestSharedBitmapManager()) { |
20 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); | 23 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); |
| 24 #if defined(OS_CHROMEOS) |
| 25 bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch( |
| 26 switches::kUIDisableThreadedCompositing); |
| 27 #else |
| 28 bool use_thread = false; |
| 29 #endif |
| 30 if (use_thread) { |
| 31 compositor_thread_.reset(new base::Thread("Browser Compositor")); |
| 32 compositor_thread_->Start(); |
| 33 } |
21 } | 34 } |
22 | 35 |
23 InProcessContextFactory::~InProcessContextFactory() {} | 36 InProcessContextFactory::~InProcessContextFactory() {} |
24 | 37 |
25 scoped_ptr<cc::OutputSurface> InProcessContextFactory::CreateOutputSurface( | 38 scoped_ptr<cc::OutputSurface> InProcessContextFactory::CreateOutputSurface( |
26 Compositor* compositor, | 39 Compositor* compositor, |
27 bool software_fallback) { | 40 bool software_fallback) { |
28 DCHECK(!software_fallback); | 41 DCHECK(!software_fallback); |
29 blink::WebGraphicsContext3D::Attributes attrs; | 42 blink::WebGraphicsContext3D::Attributes attrs; |
30 attrs.depth = false; | 43 attrs.depth = false; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 86 } |
74 | 87 |
75 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {} | 88 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {} |
76 | 89 |
77 bool InProcessContextFactory::DoesCreateTestContexts() { return false; } | 90 bool InProcessContextFactory::DoesCreateTestContexts() { return false; } |
78 | 91 |
79 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() { | 92 cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() { |
80 return shared_bitmap_manager_.get(); | 93 return shared_bitmap_manager_.get(); |
81 } | 94 } |
82 | 95 |
| 96 base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() { |
| 97 if (!compositor_thread_) |
| 98 return NULL; |
| 99 return compositor_thread_->message_loop_proxy(); |
| 100 } |
| 101 |
83 } // namespace ui | 102 } // namespace ui |
OLD | NEW |