forked from chromium/chromium
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Centralize the logic to force a repaint post display changes in an observer. This way the complexity of refreshing the display is handled in the observer rather than in every piece of code that needs to update the display state. Bug: b/180040068 Test: Ran cast_shell on the desktop to verify there are no crashes Change-Id: I022850322c8b9177463bdc0526121016ebf0f330 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2727577 Reviewed-by: Daniel Nicoara <dnicoara@chromium.org> Commit-Queue: Shiv Sakhuja <shivsak@google.com> Cr-Commit-Position: refs/heads/master@{#873512}
- Loading branch information
Shiv Sakhuja
authored and
Chromium LUCI CQ
committed
Apr 17, 2021
1 parent
d648247
commit 7ae3611
Showing
13 changed files
with
110 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "display_configurator_observer.h" | ||
|
||
namespace chromecast { | ||
|
||
DisplayConfiguratorObserver::DisplayConfiguratorObserver( | ||
chromecast::shell::CastDisplayConfigurator* display_configurator, | ||
chromecast::CastWindowManagerAura* manager) | ||
: display_configurator_(display_configurator), window_manager_(manager) { | ||
display_configurator_->AddObserver(this); | ||
} | ||
|
||
DisplayConfiguratorObserver::~DisplayConfiguratorObserver() { | ||
display_configurator_->RemoveObserver(this); | ||
} | ||
|
||
void DisplayConfiguratorObserver::OnDisplayStateChanged() { | ||
window_manager_->GetRootWindow() | ||
->GetHost() | ||
->compositor() | ||
->ScheduleFullRedraw(); | ||
} | ||
|
||
} // namespace chromecast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROMECAST_BROWSER_DISPLAY_CONFIGURATOR_OBSERVER_H_ | ||
#define CHROMECAST_BROWSER_DISPLAY_CONFIGURATOR_OBSERVER_H_ | ||
|
||
#include <memory> | ||
|
||
#include "chromecast/browser/cast_display_configurator.h" | ||
#include "chromecast/graphics/cast_window_manager_aura.h" | ||
|
||
namespace chromecast { | ||
|
||
// Observer class that can respond to Display Configurator state changes. | ||
// Forces a repaint to ensure content is refreshed post display configuration | ||
// change. | ||
class DisplayConfiguratorObserver | ||
: public shell::CastDisplayConfigurator::Observer { | ||
public: | ||
DisplayConfiguratorObserver( | ||
shell::CastDisplayConfigurator* display_configurator, | ||
CastWindowManagerAura* manager); | ||
|
||
~DisplayConfiguratorObserver() override; | ||
|
||
DisplayConfiguratorObserver(const DisplayConfiguratorObserver&) = delete; | ||
|
||
DisplayConfiguratorObserver& operator=(const DisplayConfiguratorObserver&) = | ||
delete; | ||
|
||
// CastDisplayConfigurator::Observer | ||
void OnDisplayStateChanged() override; | ||
|
||
private: | ||
shell::CastDisplayConfigurator* display_configurator_; | ||
CastWindowManagerAura* window_manager_; | ||
}; | ||
|
||
} // namespace chromecast | ||
|
||
#endif // CHROMECAST_BROWSER_DISPLAY_CONFIGURATOR_OBSERVER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters