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

Side by Side Diff: content/browser/compositor/browser_compositor_view_mac.mm

Issue 996453002: Allow ui::Compositor to disable commits during tab-switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up version Created 5 years, 9 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 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 "content/browser/compositor/browser_compositor_view_mac.h" 5 #include "content/browser/compositor/browser_compositor_view_mac.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "content/browser/compositor/image_transport_factory.h" 9 #include "content/browser/compositor/image_transport_factory.h"
10 #include "content/browser/gpu/gpu_data_manager_impl.h" 10 #include "content/browser/gpu/gpu_data_manager_impl.h"
(...skipping 28 matching lines...) Expand all
39 39
40 } // namespace 40 } // namespace
41 41
42 BrowserCompositorMac::BrowserCompositorMac() 42 BrowserCompositorMac::BrowserCompositorMac()
43 : accelerated_widget_mac_( 43 : accelerated_widget_mac_(
44 new ui::AcceleratedWidgetMac(WidgetNeedsGLFinishWorkaround())), 44 new ui::AcceleratedWidgetMac(WidgetNeedsGLFinishWorkaround())),
45 compositor_( 45 compositor_(
46 accelerated_widget_mac_->accelerated_widget(), 46 accelerated_widget_mac_->accelerated_widget(),
47 content::GetContextFactory(), 47 content::GetContextFactory(),
48 RenderWidgetResizeHelper::Get()->task_runner()) { 48 RenderWidgetResizeHelper::Get()->task_runner()) {
49 compositor_.SetLocksWillTimeOut(false);
50 compositor_suspended_lock_ = compositor_.GetCompositorLock();
danakj 2015/03/12 00:07:15 nit: Call Suspend() ?
ccameron 2015/03/12 01:01:34 Done.
49 } 51 }
50 52
51 BrowserCompositorMac::~BrowserCompositorMac() {} 53 BrowserCompositorMac::~BrowserCompositorMac() {}
52 54
55 void BrowserCompositorMac::Suspend() {
56 compositor_suspended_lock_ = compositor_.GetCompositorLock();
57 }
58
59 void BrowserCompositorMac::Unsuspend() {
60 compositor_suspended_lock_ = NULL;
danakj 2015/03/12 00:07:15 nullptr
ccameron 2015/03/12 01:01:34 Done.
61 }
62
53 // static 63 // static
54 scoped_ptr<BrowserCompositorMac> BrowserCompositorMac::Create() { 64 scoped_ptr<BrowserCompositorMac> BrowserCompositorMac::Create() {
55 if (g_recyclable_browser_compositor.Get()) 65 if (g_recyclable_browser_compositor.Get())
56 return g_recyclable_browser_compositor.Get().Pass(); 66 return g_recyclable_browser_compositor.Get().Pass();
57 return scoped_ptr<BrowserCompositorMac>(new BrowserCompositorMac).Pass(); 67 return scoped_ptr<BrowserCompositorMac>(new BrowserCompositorMac).Pass();
58 } 68 }
59 69
60 // static 70 // static
61 void BrowserCompositorMac::Recycle( 71 void BrowserCompositorMac::Recycle(
62 scoped_ptr<BrowserCompositorMac> compositor) { 72 scoped_ptr<BrowserCompositorMac> compositor) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 DCHECK_GT(g_placeholder_count, 0u); 104 DCHECK_GT(g_placeholder_count, 0u);
95 g_placeholder_count -= 1; 105 g_placeholder_count -= 1;
96 106
97 // If there are no placeholders allocated, destroy the recyclable 107 // If there are no placeholders allocated, destroy the recyclable
98 // BrowserCompositorMac. 108 // BrowserCompositorMac.
99 if (!g_placeholder_count) 109 if (!g_placeholder_count)
100 g_recyclable_browser_compositor.Get().reset(); 110 g_recyclable_browser_compositor.Get().reset();
101 } 111 }
102 112
103 } // namespace content 113 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698