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

Unified Diff: ash/wallpaper/wallpaper_controller.cc

Issue 2872123002: Wallpaper resize extents compositor lock timeout. (Closed)
Patch Set: Add NON_EXPORTED_BASE back. Created 3 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
« no previous file with comments | « ash/wallpaper/wallpaper_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wallpaper/wallpaper_controller.cc
diff --git a/ash/wallpaper/wallpaper_controller.cc b/ash/wallpaper/wallpaper_controller.cc
index 15f2cc03cdf7ace5fa513b7cf1dcb48d6ec4e02f..2991f51db0545ad44fd7796927d02d8112a4ec9a 100644
--- a/ash/wallpaper/wallpaper_controller.cc
+++ b/ash/wallpaper/wallpaper_controller.cc
@@ -8,6 +8,7 @@
#include <utility>
#include "ash/ash_switches.h"
+#include "ash/display/window_tree_host_manager.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
#include "ash/session/session_controller.h"
@@ -34,7 +35,10 @@ namespace ash {
namespace {
// How long to wait reloading the wallpaper after the display size has changed.
-const int kWallpaperReloadDelayMs = 100;
+constexpr int kWallpaperReloadDelayMs = 100;
+
+// How long to wait for resizing of the the wallpaper.
+constexpr int kCompositorLockTimeoutMs = 750;
// Returns true if a color should be extracted from the wallpaper based on the
// command kAshShelfColor line arg.
@@ -174,6 +178,7 @@ void WallpaperController::OnDisplayConfigurationChanged() {
current_max_display_size_ = max_display_size;
if (wallpaper_mode_ == WALLPAPER_IMAGE && current_wallpaper_) {
timer_.Stop();
+ GetInternalDisplayCompositorLock();
timer_.Start(FROM_HERE,
base::TimeDelta::FromMilliseconds(wallpaper_reload_delay_),
base::Bind(&WallpaperController::UpdateWallpaper,
@@ -277,6 +282,7 @@ void WallpaperController::SetWallpaper(const SkBitmap& wallpaper,
void WallpaperController::OnWallpaperResized() {
CalculateWallpaperColors();
+ compositor_lock_.reset();
}
void WallpaperController::OnColorCalculationComplete() {
@@ -408,4 +414,21 @@ bool WallpaperController::MoveToUnlockedContainer() {
return ReparentWallpaper(GetWallpaperContainerId(false));
}
+void WallpaperController::GetInternalDisplayCompositorLock() {
+ if (display::Display::HasInternalDisplay()) {
+ compositor_lock_ =
+ Shell::Get()
+ ->window_tree_host_manager()
+ ->GetRootWindowForDisplayId(display::Display::InternalDisplayId())
+ ->layer()
+ ->GetCompositor()
+ ->GetCompositorLock(this, base::TimeDelta::FromMilliseconds(
+ kCompositorLockTimeoutMs));
+ }
+}
+
+void WallpaperController::CompositorLockTimedOut() {
+ compositor_lock_.reset();
+}
+
} // namespace ash
« no previous file with comments | « ash/wallpaper/wallpaper_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698