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

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

Issue 12088092: CrOS: Enable threaded UI compositor by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Keep for enable flag for other platforms. Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/compositor_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <deque> 8 #include <deque>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 root_layer_->SetCompositor(NULL); 528 root_layer_->SetCompositor(NULL);
529 529
530 // Stop all outstanding draws before telling the ContextFactory to tear 530 // Stop all outstanding draws before telling the ContextFactory to tear
531 // down any contexts that the |host_| may rely upon. 531 // down any contexts that the |host_| may rely upon.
532 host_.reset(); 532 host_.reset();
533 533
534 ContextFactory::GetInstance()->RemoveCompositor(this); 534 ContextFactory::GetInstance()->RemoveCompositor(this);
535 } 535 }
536 536
537 // static 537 // static
538 void Compositor::Initialize(bool use_thread) { 538 void Compositor::Initialize() {
539 #if defined(OS_CHROMEOS)
540 bool use_thread = !CommandLine::ForCurrentProcess()->HasSwitch(
541 switches::kUIDisableThreadedCompositing);
542 #else
543 bool use_thread =
544 CommandLine::ForCurrentProcess()->HasSwitch(
545 switches::kUIEnableThreadedCompositing) &&
546 !CommandLine::ForCurrentProcess()->HasSwitch(
547 switches::kUIDisableThreadedCompositing);
548 #endif
539 if (use_thread) { 549 if (use_thread) {
540 g_compositor_thread = new base::Thread("Browser Compositor"); 550 g_compositor_thread = new base::Thread("Browser Compositor");
541 g_compositor_thread->Start(); 551 g_compositor_thread->Start();
542 } 552 }
543 } 553 }
544 554
545 // static 555 // static
546 bool Compositor::WasInitializedWithThread() { 556 bool Compositor::WasInitializedWithThread() {
547 return !!g_compositor_thread; 557 return !!g_compositor_thread;
548 } 558 }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 COMPOSITOR_EXPORT void DisableTestCompositor() { 820 COMPOSITOR_EXPORT void DisableTestCompositor() {
811 ResetImplicitFactory(); 821 ResetImplicitFactory();
812 g_test_compositor_enabled = false; 822 g_test_compositor_enabled = false;
813 } 823 }
814 824
815 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { 825 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() {
816 return g_test_compositor_enabled; 826 return g_test_compositor_enabled;
817 } 827 }
818 828
819 } // namespace ui 829 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/compositor_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698