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

Unified Diff: ui/accelerated_widget_mac/accelerated_widget_mac.mm

Issue 1952163002: Mac fullscreen low power video: Add FullscreenLowPowerControllerCocoa (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@plumb_widget
Patch Set: Rebase Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
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_)
« no previous file with comments | « ui/accelerated_widget_mac/accelerated_widget_mac.gyp ('k') | ui/accelerated_widget_mac/fullscreen_low_power_coordinator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698