Fix dependency on scoped_ptr::reset sequencing in ash::DisplayController

scoped_ptr<T>::reset() currently guarantees that it deletes the old
stored pointer before assigning its argument to the stored pointer.
This is unsafe, because getting the deleter may result in the
destruction of the scoped_ptr<T> itself. unique_ptr<T> addresses this by
assigning its argument to the stored pointer before deleting the old
value of the stored pointer.

Unfortunately, this breaks code that assumes that the value of the
scoped_ptr will not change during scoped_ptr::reset() before destruction
of the old value is complete.

BUG=176091


Review URL: https://chromiumcodereview.appspot.com/12296033

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183479 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ash/shell.cc b/ash/shell.cc
index cd317d71..1a386ea7 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -288,7 +288,10 @@
   power_button_controller_.reset();
   session_state_controller_.reset();
 
-  // This also deletes all RootWindows.
+  // This also deletes all RootWindows. Note that we invoke Shutdown() on
+  // DisplayController before resetting |display_controller_|, since destruction
+  // of its owned RootWindowControllers relies on the value.
+  display_controller_->Shutdown();
   display_controller_.reset();
   screen_position_controller_.reset();