| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 InProcessContextFactory::InProcessContextFactory( | 67 InProcessContextFactory::InProcessContextFactory( |
| 68 bool context_factory_for_test, | 68 bool context_factory_for_test, |
| 69 cc::SurfaceManager* surface_manager) | 69 cc::SurfaceManager* surface_manager) |
| 70 : next_surface_id_namespace_(1u), | 70 : next_surface_id_namespace_(1u), |
| 71 use_test_surface_(true), | 71 use_test_surface_(true), |
| 72 context_factory_for_test_(context_factory_for_test), | 72 context_factory_for_test_(context_factory_for_test), |
| 73 surface_manager_(surface_manager) { | 73 surface_manager_(surface_manager) { |
| 74 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) | 74 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) |
| 75 << "If running tests, ensure that main() is calling " | 75 << "If running tests, ensure that main() is calling " |
| 76 << "gfx::GLSurface::InitializeOneOffForTests()"; | 76 << "gfx::GLSurface::InitializeOneOffForTests()"; |
| 77 | |
| 78 #if defined(OS_CHROMEOS) | |
| 79 bool use_thread = !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 80 switches::kUIDisableThreadedCompositing); | |
| 81 #else | |
| 82 bool use_thread = false; | |
| 83 #endif | |
| 84 if (use_thread) { | |
| 85 compositor_thread_.reset(new base::Thread("Browser Compositor")); | |
| 86 compositor_thread_->Start(); | |
| 87 } | |
| 88 } | 77 } |
| 89 | 78 |
| 90 InProcessContextFactory::~InProcessContextFactory() { | 79 InProcessContextFactory::~InProcessContextFactory() { |
| 91 DCHECK(per_compositor_data_.empty()); | 80 DCHECK(per_compositor_data_.empty()); |
| 92 } | 81 } |
| 93 | 82 |
| 94 void InProcessContextFactory::CreateOutputSurface( | 83 void InProcessContextFactory::CreateOutputSurface( |
| 95 base::WeakPtr<Compositor> compositor, | 84 base::WeakPtr<Compositor> compositor, |
| 96 bool software_fallback) { | 85 bool software_fallback) { |
| 97 DCHECK(!software_fallback); | 86 DCHECK(!software_fallback); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 192 } |
| 204 | 193 |
| 205 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, | 194 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, |
| 206 const gfx::Size& size) { | 195 const gfx::Size& size) { |
| 207 if (!per_compositor_data_.count(compositor)) | 196 if (!per_compositor_data_.count(compositor)) |
| 208 return; | 197 return; |
| 209 per_compositor_data_[compositor]->display()->Resize(size); | 198 per_compositor_data_[compositor]->display()->Resize(size); |
| 210 } | 199 } |
| 211 | 200 |
| 212 } // namespace ui | 201 } // namespace ui |
| OLD | NEW |