| 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 } | |
| 81 } | 70 } |
| 82 | 71 |
| 83 InProcessContextFactory::~InProcessContextFactory() {} | 72 InProcessContextFactory::~InProcessContextFactory() {} |
| 84 | 73 |
| 85 void InProcessContextFactory::CreateOutputSurface( | 74 void InProcessContextFactory::CreateOutputSurface( |
| 86 base::WeakPtr<Compositor> compositor, | 75 base::WeakPtr<Compositor> compositor, |
| 87 bool software_fallback) { | 76 bool software_fallback) { |
| 88 DCHECK(!software_fallback); | 77 DCHECK(!software_fallback); |
| 89 gpu::gles2::ContextCreationAttribHelper attribs; | 78 gpu::gles2::ContextCreationAttribHelper attribs; |
| 90 attribs.alpha_size = 8; | 79 attribs.alpha_size = 8; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 InProcessContextFactory::CreateSurfaceIdAllocator() { | 150 InProcessContextFactory::CreateSurfaceIdAllocator() { |
| 162 return make_scoped_ptr( | 151 return make_scoped_ptr( |
| 163 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); | 152 new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); |
| 164 } | 153 } |
| 165 | 154 |
| 166 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, | 155 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, |
| 167 const gfx::Size& size) { | 156 const gfx::Size& size) { |
| 168 } | 157 } |
| 169 | 158 |
| 170 } // namespace ui | 159 } // namespace ui |
| OLD | NEW |