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

Unified Diff: ui/display/chromeos/display_configurator.cc

Issue 2498103002: Fix potential GPU crash caused by VT switching (Closed)
Patch Set: Add doc Created 4 years, 1 month 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 | « ui/display/chromeos/display_configurator.h ('k') | ui/display/chromeos/display_configurator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/chromeos/display_configurator.cc
diff --git a/ui/display/chromeos/display_configurator.cc b/ui/display/chromeos/display_configurator.cc
index ed55d22e6f2438b7a4383fa624149f64ec3047bb..e6327b476301e0fe8c35636d538cd7c5cfbb4828 100644
--- a/ui/display/chromeos/display_configurator.cc
+++ b/ui/display/chromeos/display_configurator.cc
@@ -557,8 +557,11 @@ void DisplayConfigurator::OnDisplayControlTaken(
display_control_changing_ = false;
display_externally_controlled_ = !success;
if (success) {
+ // Force a configuration since the display configuration may have changed.
force_configure_ = true;
- RunPendingConfiguration();
+ // Restore the last power state used before releasing control.
+ SetDisplayPower(requested_power_state_, kSetDisplayPowerNoFlags,
+ base::Bind(&DoNothing));
}
callback.Run(success);
@@ -582,15 +585,31 @@ void DisplayConfigurator::RelinquishControl(
return;
}
- // Set the flag early such that an incoming configuration event won't start
- // while we're releasing control of the displays.
display_control_changing_ = true;
- display_externally_controlled_ = true;
- native_display_delegate_->RelinquishDisplayControl(
- base::Bind(&DisplayConfigurator::OnDisplayControlRelinquished,
+
+ // Turn off the displays before releasing control since we're no longer using
+ // them for output.
+ SetDisplayPowerInternal(
+ chromeos::DISPLAY_POWER_ALL_OFF, kSetDisplayPowerNoFlags,
+ base::Bind(&DisplayConfigurator::SendRelinquishDisplayControl,
weak_ptr_factory_.GetWeakPtr(), callback));
}
+void DisplayConfigurator::SendRelinquishDisplayControl(
+ const DisplayControlCallback& callback, bool success) {
+ if (success) {
+ // Set the flag early such that an incoming configuration event won't start
+ // while we're releasing control of the displays.
+ display_externally_controlled_ = true;
+ native_display_delegate_->RelinquishDisplayControl(
+ base::Bind(&DisplayConfigurator::OnDisplayControlRelinquished,
+ weak_ptr_factory_.GetWeakPtr(), callback));
+ } else {
+ display_control_changing_ = false;
+ callback.Run(false);
+ }
+}
+
void DisplayConfigurator::OnDisplayControlRelinquished(
const DisplayControlCallback& callback,
bool success) {
« no previous file with comments | « ui/display/chromeos/display_configurator.h ('k') | ui/display/chromeos/display_configurator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698