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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 DISALLOW_COPY_AND_ASSIGN(DirectOutputSurface); | 60 DISALLOW_COPY_AND_ASSIGN(DirectOutputSurface); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace | 63 } // namespace |
64 | 64 |
65 InProcessContextFactory::InProcessContextFactory() | 65 InProcessContextFactory::InProcessContextFactory() |
66 : next_surface_id_namespace_(1u), use_test_surface_(true) { | 66 : next_surface_id_namespace_(1u), use_test_surface_(true) { |
67 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) | 67 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) |
68 << "If running tests, ensure that main() is calling " | 68 << "If running tests, ensure that main() is calling " |
69 << "gfx::GLSurface::InitializeOneOffForTests()"; | 69 << "gfx::GLSurface::InitializeOneOffForTests()"; |
| 70 |
| 71 #if defined(OS_CHROMEOS) |
| 72 bool use_thread = !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 73 switches::kUIDisableThreadedCompositing); |
| 74 #else |
| 75 bool use_thread = false; |
| 76 #endif |
| 77 if (use_thread) { |
| 78 compositor_thread_.reset(new base::Thread("Browser Compositor")); |
| 79 compositor_thread_->Start(); |
| 80 } |
70 } | 81 } |
71 | 82 |
72 InProcessContextFactory::~InProcessContextFactory() {} | 83 InProcessContextFactory::~InProcessContextFactory() {} |
73 | 84 |
74 void InProcessContextFactory::CreateOutputSurface( | 85 void InProcessContextFactory::CreateOutputSurface( |
75 base::WeakPtr<Compositor> compositor, | 86 base::WeakPtr<Compositor> compositor, |
76 bool software_fallback) { | 87 bool software_fallback) { |
77 DCHECK(!software_fallback); | 88 DCHECK(!software_fallback); |
78 gpu::gles2::ContextCreationAttribHelper attribs; | 89 gpu::gles2::ContextCreationAttribHelper attribs; |
79 attribs.alpha_size = 8; | 90 attribs.alpha_size = 8; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 InProcessContextFactory::CreateSurfaceIdAllocator() { | 161 InProcessContextFactory::CreateSurfaceIdAllocator() { |
151 return make_scoped_ptr( | 162 return make_scoped_ptr( |
152 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); | 163 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); |
153 } | 164 } |
154 | 165 |
155 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, | 166 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, |
156 const gfx::Size& size) { | 167 const gfx::Size& size) { |
157 } | 168 } |
158 | 169 |
159 } // namespace ui | 170 } // namespace ui |
OLD | NEW |