OLD | NEW |
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/renderer_host/browser_compositor_view_mac.h" | 5 #include "content/browser/renderer_host/browser_compositor_view_mac.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 std::unique_ptr<ui::AcceleratedWidgetMac> accelerated_widget_mac_; | 92 std::unique_ptr<ui::AcceleratedWidgetMac> accelerated_widget_mac_; |
93 ui::Compositor compositor_; | 93 ui::Compositor compositor_; |
94 scoped_refptr<ui::CompositorLock> compositor_suspended_lock_; | 94 scoped_refptr<ui::CompositorLock> compositor_suspended_lock_; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(RecyclableCompositorMac); | 96 DISALLOW_COPY_AND_ASSIGN(RecyclableCompositorMac); |
97 }; | 97 }; |
98 | 98 |
99 RecyclableCompositorMac::RecyclableCompositorMac() | 99 RecyclableCompositorMac::RecyclableCompositorMac() |
100 : accelerated_widget_mac_(new ui::AcceleratedWidgetMac()), | 100 : accelerated_widget_mac_(new ui::AcceleratedWidgetMac()), |
101 compositor_(content::GetContextFactory(), | 101 compositor_(content::GetContextFactory(), |
| 102 content::GetContextFactoryPrivate(), |
102 ui::WindowResizeHelperMac::Get()->task_runner()) { | 103 ui::WindowResizeHelperMac::Get()->task_runner()) { |
103 compositor_.SetAcceleratedWidget( | 104 compositor_.SetAcceleratedWidget( |
104 accelerated_widget_mac_->accelerated_widget()); | 105 accelerated_widget_mac_->accelerated_widget()); |
105 compositor_.SetLocksWillTimeOut(false); | 106 compositor_.SetLocksWillTimeOut(false); |
106 Suspend(); | 107 Suspend(); |
107 compositor_.AddObserver(this); | 108 compositor_.AddObserver(this); |
108 } | 109 } |
109 | 110 |
110 RecyclableCompositorMac::~RecyclableCompositorMac() { | 111 RecyclableCompositorMac::~RecyclableCompositorMac() { |
111 compositor_.RemoveObserver(this); | 112 compositor_.RemoveObserver(this); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 bool render_widget_host_is_hidden, | 169 bool render_widget_host_is_hidden, |
169 bool ns_view_attached_to_window) | 170 bool ns_view_attached_to_window) |
170 : client_(client), | 171 : client_(client), |
171 accelerated_widget_mac_ns_view_(accelerated_widget_mac_ns_view), | 172 accelerated_widget_mac_ns_view_(accelerated_widget_mac_ns_view), |
172 weak_factory_(this) { | 173 weak_factory_(this) { |
173 g_browser_compositor_count += 1; | 174 g_browser_compositor_count += 1; |
174 | 175 |
175 root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); | 176 root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); |
176 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 177 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
177 delegated_frame_host_.reset(new DelegatedFrameHost( | 178 delegated_frame_host_.reset(new DelegatedFrameHost( |
178 factory->GetContextFactory()->AllocateFrameSinkId(), this)); | 179 factory->GetContextFactoryPrivate()->AllocateFrameSinkId(), this)); |
179 | 180 |
180 SetRenderWidgetHostIsHidden(render_widget_host_is_hidden); | 181 SetRenderWidgetHostIsHidden(render_widget_host_is_hidden); |
181 SetNSViewAttachedToWindow(ns_view_attached_to_window); | 182 SetNSViewAttachedToWindow(ns_view_attached_to_window); |
182 } | 183 } |
183 | 184 |
184 BrowserCompositorMac::~BrowserCompositorMac() { | 185 BrowserCompositorMac::~BrowserCompositorMac() { |
185 // Ensure that copy callbacks completed or cancelled during further tear-down | 186 // Ensure that copy callbacks completed or cancelled during further tear-down |
186 // do not call back into this. | 187 // do not call back into this. |
187 weak_factory_.InvalidateWeakPtrs(); | 188 weak_factory_.InvalidateWeakPtrs(); |
188 | 189 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 467 |
467 const cc::BeginFrameArgs& BrowserCompositorMac::LastUsedBeginFrameArgs() const { | 468 const cc::BeginFrameArgs& BrowserCompositorMac::LastUsedBeginFrameArgs() const { |
468 return last_begin_frame_args_; | 469 return last_begin_frame_args_; |
469 } | 470 } |
470 | 471 |
471 void BrowserCompositorMac::OnBeginFrameSourcePausedChanged(bool paused) { | 472 void BrowserCompositorMac::OnBeginFrameSourcePausedChanged(bool paused) { |
472 // Only used on Android WebView. | 473 // Only used on Android WebView. |
473 } | 474 } |
474 | 475 |
475 } // namespace content | 476 } // namespace content |
OLD | NEW |