| Index: ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
| diff --git a/ui/accelerated_widget_mac/accelerated_widget_mac.mm b/ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
| index 9853d566b26892ad4dd2d6ba9bac0b25dafb64d0..bc496e1587a24c4e7b681cadb8c3de60664bdd69 100644
|
| --- a/ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
| +++ b/ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
| @@ -13,6 +13,7 @@
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/trace_event/trace_event.h"
|
| #include "third_party/skia/include/core/SkCanvas.h"
|
| +#include "ui/accelerated_widget_mac/fullscreen_low_power_coordinator.h"
|
| #include "ui/base/cocoa/animation_utils.h"
|
| #include "ui/gfx/geometry/dip_util.h"
|
| #include "ui/gl/scoped_cgl.h"
|
| @@ -77,6 +78,7 @@ void AcceleratedWidgetMac::SetNSView(AcceleratedWidgetMacNSView* view) {
|
| // Disable the fade-in animation as the view is added.
|
| ScopedCAActionDisabler disabler;
|
|
|
| + DCHECK(!fslp_coordinator_);
|
| DCHECK(view && !view_);
|
| view_ = view;
|
|
|
| @@ -90,6 +92,11 @@ void AcceleratedWidgetMac::ResetNSView() {
|
| if (!view_)
|
| return;
|
|
|
| + if (fslp_coordinator_) {
|
| + fslp_coordinator_->WillLoseAcceleratedWidget();
|
| + DCHECK(!fslp_coordinator_);
|
| + }
|
| +
|
| // Disable the fade-out animation as the view is removed.
|
| ScopedCAActionDisabler disabler;
|
|
|
| @@ -101,6 +108,22 @@ void AcceleratedWidgetMac::ResetNSView() {
|
| view_ = NULL;
|
| }
|
|
|
| +void AcceleratedWidgetMac::SetFullscreenLowPowerCoordinator(
|
| + FullscreenLowPowerCoordinator* coordinator) {
|
| + DCHECK(coordinator);
|
| + DCHECK(!fslp_coordinator_);
|
| + fslp_coordinator_ = coordinator;
|
| +}
|
| +
|
| +void AcceleratedWidgetMac::ResetFullscreenLowPowerCoordinator() {
|
| + DCHECK(fslp_coordinator_);
|
| + fslp_coordinator_ = nullptr;
|
| +}
|
| +
|
| +CALayer* AcceleratedWidgetMac::GetFullscreenLowPowerLayer() const {
|
| + return fullscreen_low_power_layer_;
|
| +}
|
| +
|
| bool AcceleratedWidgetMac::HasFrameOfSize(
|
| const gfx::Size& dip_size) const {
|
| return last_swap_size_dip_ == dip_size;
|
| @@ -173,11 +196,20 @@ void AcceleratedWidgetMac::GotCAContextFrame(
|
| if ([fullscreen_low_power_layer_ contextId] !=
|
| fullscreen_low_power_ca_context_id) {
|
| TRACE_EVENT0("ui", "Creating a new CALayerHost");
|
| + if (fslp_coordinator_) {
|
| + fslp_coordinator_->WillLoseAcceleratedWidget();
|
| + DCHECK(!fslp_coordinator_);
|
| + }
|
| fullscreen_low_power_layer_.reset([[CALayerHost alloc] init]);
|
| [fullscreen_low_power_layer_
|
| setContextId:fullscreen_low_power_ca_context_id];
|
| }
|
|
|
| + if (fslp_coordinator_) {
|
| + fslp_coordinator_->SetLowPowerLayerValid(
|
| + fullscreen_low_power_ca_context_valid);
|
| + }
|
| +
|
| // If this replacing a same-type layer, remove it now that the new layer is
|
| // in the hierarchy.
|
| if (old_ca_context_layer != ca_context_layer_)
|
|
|