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

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

Issue 1354533002: Mac: move content::RenderWidgetResizeHelper to ui::WindowResizeHelperMac (acelerated_widget_mac) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rejig class comments Created 5 years, 3 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
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/gpu/gpu_process_host.cc » ('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 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"
11 #include "content/browser/renderer_host/render_widget_resize_helper_mac.h"
12 #include "content/public/browser/context_factory.h" 11 #include "content/public/browser/context_factory.h"
13 #include "gpu/config/gpu_driver_bug_workaround_type.h" 12 #include "gpu/config/gpu_driver_bug_workaround_type.h"
14 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" 13 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
14 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
15 15
16 //////////////////////////////////////////////////////////////////////////////// 16 ////////////////////////////////////////////////////////////////////////////////
17 // BrowserCompositorMac 17 // BrowserCompositorMac
18 18
19 namespace content { 19 namespace content {
20 20
21 namespace { 21 namespace {
22 22
23 // Set when no browser compositors should remain alive. 23 // Set when no browser compositors should remain alive.
24 bool g_has_shut_down = false; 24 bool g_has_shut_down = false;
(...skipping 10 matching lines...) Expand all
35 bool WidgetNeedsGLFinishWorkaround() { 35 bool WidgetNeedsGLFinishWorkaround() {
36 return GpuDataManagerImpl::GetInstance()->IsDriverBugWorkaroundActive( 36 return GpuDataManagerImpl::GetInstance()->IsDriverBugWorkaroundActive(
37 gpu::FORCE_GL_FINISH_AFTER_COMPOSITING); 37 gpu::FORCE_GL_FINISH_AFTER_COMPOSITING);
38 } 38 }
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_(content::GetContextFactory(),
46 content::GetContextFactory(), 46 ui::WindowResizeHelperMac::Get()->task_runner()) {
47 RenderWidgetResizeHelper::Get()->task_runner()) {
48 compositor_.SetAcceleratedWidgetAndStartCompositor( 47 compositor_.SetAcceleratedWidgetAndStartCompositor(
49 accelerated_widget_mac_->accelerated_widget()); 48 accelerated_widget_mac_->accelerated_widget());
50 compositor_.SetLocksWillTimeOut(false); 49 compositor_.SetLocksWillTimeOut(false);
51 Suspend(); 50 Suspend();
52 compositor_.AddObserver(this); 51 compositor_.AddObserver(this);
53 } 52 }
54 53
55 BrowserCompositorMac::~BrowserCompositorMac() { 54 BrowserCompositorMac::~BrowserCompositorMac() {
56 compositor_.RemoveObserver(this); 55 compositor_.RemoveObserver(this);
57 } 56 }
58 57
59 void BrowserCompositorMac::Suspend() { 58 void BrowserCompositorMac::Suspend() {
60 compositor_suspended_lock_ = compositor_.GetCompositorLock(); 59 compositor_suspended_lock_ = compositor_.GetCompositorLock();
61 } 60 }
62 61
63 void BrowserCompositorMac::Unsuspend() { 62 void BrowserCompositorMac::Unsuspend() {
64 compositor_suspended_lock_ = nullptr; 63 compositor_suspended_lock_ = nullptr;
65 } 64 }
66 65
67 void BrowserCompositorMac::OnCompositingDidCommit( 66 void BrowserCompositorMac::OnCompositingDidCommit(
68 ui::Compositor* compositor_that_did_commit) { 67 ui::Compositor* compositor_that_did_commit) {
69 DCHECK_EQ(compositor_that_did_commit, compositor()); 68 DCHECK_EQ(compositor_that_did_commit, compositor());
70 content::ImageTransportFactory::GetInstance() 69 content::ImageTransportFactory::GetInstance()
71 ->SetCompositorSuspendedForRecycle(compositor(), false); 70 ->SetCompositorSuspendedForRecycle(compositor(), false);
72 } 71 }
73 72
74 // static 73 // static
75 scoped_ptr<BrowserCompositorMac> BrowserCompositorMac::Create() { 74 scoped_ptr<BrowserCompositorMac> BrowserCompositorMac::Create() {
75 DCHECK(ui::WindowResizeHelperMac::Get()->task_runner());
76 if (g_recyclable_browser_compositor.Get()) 76 if (g_recyclable_browser_compositor.Get())
77 return g_recyclable_browser_compositor.Get().Pass(); 77 return g_recyclable_browser_compositor.Get().Pass();
78 return scoped_ptr<BrowserCompositorMac>(new BrowserCompositorMac).Pass(); 78 return scoped_ptr<BrowserCompositorMac>(new BrowserCompositorMac).Pass();
79 } 79 }
80 80
81 // static 81 // static
82 void BrowserCompositorMac::Recycle( 82 void BrowserCompositorMac::Recycle(
83 scoped_ptr<BrowserCompositorMac> compositor) { 83 scoped_ptr<BrowserCompositorMac> compositor) {
84 DCHECK(compositor); 84 DCHECK(compositor);
85 content::ImageTransportFactory::GetInstance() 85 content::ImageTransportFactory::GetInstance()
(...skipping 29 matching lines...) Expand all
115 DCHECK_GT(g_placeholder_count, 0u); 115 DCHECK_GT(g_placeholder_count, 0u);
116 g_placeholder_count -= 1; 116 g_placeholder_count -= 1;
117 117
118 // If there are no placeholders allocated, destroy the recyclable 118 // If there are no placeholders allocated, destroy the recyclable
119 // BrowserCompositorMac. 119 // BrowserCompositorMac.
120 if (!g_placeholder_count) 120 if (!g_placeholder_count)
121 g_recyclable_browser_compositor.Get().reset(); 121 g_recyclable_browser_compositor.Get().reset();
122 } 122 }
123 123
124 } // namespace content 124 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698