Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/compositor.h" | 5 #include "ui/compositor/compositor.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 | 169 |
| 170 // Stop all outstanding draws before telling the ContextFactory to tear | 170 // Stop all outstanding draws before telling the ContextFactory to tear |
| 171 // down any contexts that the |host_| may rely upon. | 171 // down any contexts that the |host_| may rely upon. |
| 172 host_.reset(); | 172 host_.reset(); |
| 173 | 173 |
| 174 if (!test_compositor_enabled) | 174 if (!test_compositor_enabled) |
| 175 ContextFactory::GetInstance()->RemoveCompositor(this); | 175 ContextFactory::GetInstance()->RemoveCompositor(this); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void Compositor::Initialize(bool use_thread) { | 178 void Compositor::Initialize(bool use_thread) { |
| 179 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 180 WebKit::WebCompositorSupport* compositor_support = | 179 WebKit::WebCompositorSupport* compositor_support = |
| 181 WebKit::Platform::current()->compositorSupport(); | 180 WebKit::Platform::current()->compositorSupport(); |
| 182 // These settings must be applied before we initialize the compositor. | |
| 183 compositor_support->setPartialSwapEnabled( | |
| 184 command_line->HasSwitch(switches::kUIEnablePartialSwap)); | |
| 185 compositor_support->setPerTilePaintingEnabled( | |
| 186 command_line->HasSwitch(switches::kUIEnablePerTilePainting)); | |
|
jamesr
2012/10/18 02:44:32
notice that this is checking switches::kUIEnablePa
| |
| 187 if (use_thread) | 181 if (use_thread) |
| 188 g_compositor_thread = new webkit_glue::WebThreadImpl("Browser Compositor"); | 182 g_compositor_thread = new webkit_glue::WebThreadImpl("Browser Compositor"); |
| 189 compositor_support->initialize(g_compositor_thread); | 183 compositor_support->initialize(g_compositor_thread); |
| 190 } | 184 } |
| 191 | 185 |
| 192 void Compositor::Terminate() { | 186 void Compositor::Terminate() { |
| 193 WebKit::Platform::current()->compositorSupport()->shutdown(); | 187 WebKit::Platform::current()->compositorSupport()->shutdown(); |
| 194 if (g_compositor_thread) { | 188 if (g_compositor_thread) { |
| 195 delete g_compositor_thread; | 189 delete g_compositor_thread; |
| 196 g_compositor_thread = NULL; | 190 g_compositor_thread = NULL; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 | 430 |
| 437 COMPOSITOR_EXPORT void DisableTestCompositor() { | 431 COMPOSITOR_EXPORT void DisableTestCompositor() { |
| 438 test_compositor_enabled = false; | 432 test_compositor_enabled = false; |
| 439 } | 433 } |
| 440 | 434 |
| 441 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 435 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
| 442 return test_compositor_enabled; | 436 return test_compositor_enabled; |
| 443 } | 437 } |
| 444 | 438 |
| 445 } // namespace ui | 439 } // namespace ui |
| OLD | NEW |