Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: ui/compositor/compositor.cc

Issue 11186039: Move CC switches to cc/switches.h. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed nits and made ui/ depend on ui/gfx/ Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "cc/settings.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSuppor t.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSuppor t.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h"
16 #include "ui/compositor/compositor_observer.h" 17 #include "ui/compositor/compositor_observer.h"
17 #include "ui/compositor/compositor_switches.h" 18 #include "ui/compositor/compositor_switches.h"
18 #include "ui/compositor/dip_util.h" 19 #include "ui/compositor/dip_util.h"
19 #include "ui/compositor/layer.h" 20 #include "ui/compositor/layer.h"
20 #include "ui/compositor/test_web_graphics_context_3d.h" 21 #include "ui/compositor/test_web_graphics_context_3d.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 170
170 // Stop all outstanding draws before telling the ContextFactory to tear 171 // Stop all outstanding draws before telling the ContextFactory to tear
171 // down any contexts that the |host_| may rely upon. 172 // down any contexts that the |host_| may rely upon.
172 host_.reset(); 173 host_.reset();
173 174
174 if (!test_compositor_enabled) 175 if (!test_compositor_enabled)
175 ContextFactory::GetInstance()->RemoveCompositor(this); 176 ContextFactory::GetInstance()->RemoveCompositor(this);
176 } 177 }
177 178
178 void Compositor::Initialize(bool use_thread) { 179 void Compositor::Initialize(bool use_thread) {
179 CommandLine* command_line = CommandLine::ForCurrentProcess(); 180 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
181 cc::Settings::setPartialSwapEnabled(
182 command_line.HasSwitch(switches::kUIEnablePartialSwap));
183 cc::Settings::setPerTilePaintingEnabled(
184 command_line.HasSwitch(switches::kUIEnablePerTilePainting));
185
180 WebKit::WebCompositorSupport* compositor_support = 186 WebKit::WebCompositorSupport* compositor_support =
181 WebKit::Platform::current()->compositorSupport(); 187 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));
187 if (use_thread) 188 if (use_thread)
188 g_compositor_thread = new webkit_glue::WebThreadImpl("Browser Compositor"); 189 g_compositor_thread = new webkit_glue::WebThreadImpl("Browser Compositor");
189 compositor_support->initialize(g_compositor_thread); 190 compositor_support->initialize(g_compositor_thread);
190 } 191 }
191 192
192 void Compositor::Terminate() { 193 void Compositor::Terminate() {
193 WebKit::Platform::current()->compositorSupport()->shutdown(); 194 WebKit::Platform::current()->compositorSupport()->shutdown();
194 if (g_compositor_thread) { 195 if (g_compositor_thread) {
195 delete g_compositor_thread; 196 delete g_compositor_thread;
196 g_compositor_thread = NULL; 197 g_compositor_thread = NULL;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 437
437 COMPOSITOR_EXPORT void DisableTestCompositor() { 438 COMPOSITOR_EXPORT void DisableTestCompositor() {
438 test_compositor_enabled = false; 439 test_compositor_enabled = false;
439 } 440 }
440 441
441 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { 442 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() {
442 return test_compositor_enabled; 443 return test_compositor_enabled;
443 } 444 }
444 445
445 } // namespace ui 446 } // namespace ui
OLDNEW
« ui/DEPS ('K') | « ui/DEPS ('k') | webkit/compositor_bindings/WebCompositorImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698