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

Unified Diff: chromeos/display/output_configurator.cc

Issue 10825306: Refresh output cache when setting display mode (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 8 years, 4 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 | « chromeos/display/output_configurator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/display/output_configurator.cc
diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc
index d3f23114e496d6c989bf7c6a4b91bf569b267069..b3506dc30a9853cf42278cac451e066d02c581cf 100644
--- a/chromeos/display/output_configurator.cc
+++ b/chromeos/display/output_configurator.cc
@@ -394,6 +394,9 @@ bool OutputConfigurator::SetDisplayMode(OutputState new_state) {
XRRScreenResources* screen = XRRGetScreenResources(display, window);
CHECK(screen != NULL);
+ // We are about to act on the cached output data but it could be stale so
+ // force the outputs to be recached.
+ ForceRecacheOutputs(display, screen);
UpdateCacheAndXrandrToState(display,
screen,
window,
@@ -463,9 +466,15 @@ bool OutputConfigurator::TryRecacheOutputs(Display* display,
}
}
- if (!outputs_did_change)
- return false;
- // We now know that we need to recache so free and re-alloc the buffer.
+ if (outputs_did_change) {
+ // We now know that we need to recache so free and re-alloc the buffer.
+ ForceRecacheOutputs(display, screen);
+ }
+ return outputs_did_change;
+}
+
+void OutputConfigurator::ForceRecacheOutputs(Display* display,
+ XRRScreenResources* screen) {
output_count_ = screen->noutput;
if (output_count_ == 0) {
output_cache_.reset(NULL);
@@ -570,7 +579,6 @@ bool OutputConfigurator::TryRecacheOutputs(Display* display,
<< " primary " << primary_mode
<< " secondary " << second_mode;
}
- return outputs_did_change;
}
void OutputConfigurator::UpdateCacheAndXrandrToState(
« no previous file with comments | « chromeos/display/output_configurator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698