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

Side by Side Diff: ui/views/mus/screen_mus.cc

Issue 1928733002: mus/views: Call to WaitForIncomingMethodCall() can fail. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/mus/screen_mus.h" 5 #include "ui/views/mus/screen_mus.h"
6 6
7 #include "mojo/converters/geometry/geometry_type_converters.h" 7 #include "mojo/converters/geometry/geometry_type_converters.h"
8 #include "services/shell/public/cpp/connection.h" 8 #include "services/shell/public/cpp/connection.h"
9 #include "services/shell/public/cpp/connector.h" 9 #include "services/shell/public/cpp/connector.h"
10 #include "ui/gfx/display_finder.h" 10 #include "ui/gfx/display_finder.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 connector->ConnectToInterface("mojo:mus", &display_manager_); 90 connector->ConnectToInterface("mojo:mus", &display_manager_);
91 91
92 display_manager_->AddObserver( 92 display_manager_->AddObserver(
93 display_manager_observer_binding_.CreateInterfacePtrAndBind()); 93 display_manager_observer_binding_.CreateInterfacePtrAndBind());
94 94
95 // We need the set of displays before we can continue. Wait for it. 95 // We need the set of displays before we can continue. Wait for it.
96 // 96 //
97 // TODO(rockot): Do something better here. This should not have to block tasks 97 // TODO(rockot): Do something better here. This should not have to block tasks
98 // from running on the calling thread. http://crbug.com/594852. 98 // from running on the calling thread. http://crbug.com/594852.
99 display_manager_observer_binding_.WaitForIncomingMethodCall(); 99 bool success = display_manager_observer_binding_.WaitForIncomingMethodCall();
100 100
101 // The WaitForIncomingMethodCall() should have supplied the set of Displays, 101 // The WaitForIncomingMethodCall() should have supplied the set of Displays,
102 // unless mus is going down, in which case encountered_error() is true. 102 // unless mus is going down, in which case encountered_error() is true, or the
103 // call to WaitForIncomingMethodCall() failed.
103 if (displays_.empty()) { 104 if (displays_.empty()) {
104 DCHECK(display_manager_.encountered_error()); 105 DCHECK(display_manager_.encountered_error() || !success);
sky 2016/04/27 21:09:59 Isn't encountered_error set in this case?
sadrul 2016/04/27 21:39:24 Apparently not. (it's easy to hit this DCHECK() wi
105 // In this case we install a default display and assume the process is 106 // In this case we install a default display and assume the process is
106 // going to exit shortly so that the real value doesn't matter. 107 // going to exit shortly so that the real value doesn't matter.
107 displays_.push_back(gfx::Display(0xFFFFFFFF, gfx::Rect(0, 0, 801, 802))); 108 displays_.push_back(gfx::Display(0xFFFFFFFF, gfx::Rect(0, 0, 801, 802)));
108 } 109 }
109 } 110 }
110 111
111 int ScreenMus::FindDisplayIndexById(int64_t id) const { 112 int ScreenMus::FindDisplayIndexById(int64_t id) const {
112 for (size_t i = 0; i < displays_.size(); ++i) { 113 for (size_t i = 0; i < displays_.size(); ++i) {
113 if (displays_[i].id() == id) 114 if (displays_[i].id() == id)
114 return static_cast<int>(i); 115 return static_cast<int>(i);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 DCHECK_NE(-1, index); 247 DCHECK_NE(-1, index);
247 // Another display must become primary before the existing primary is 248 // Another display must become primary before the existing primary is
248 // removed. 249 // removed.
249 DCHECK_NE(index, primary_display_index_); 250 DCHECK_NE(index, primary_display_index_);
250 const gfx::Display display = displays_[index]; 251 const gfx::Display display = displays_[index];
251 FOR_EACH_OBSERVER(gfx::DisplayObserver, observers_, 252 FOR_EACH_OBSERVER(gfx::DisplayObserver, observers_,
252 OnDisplayRemoved(display)); 253 OnDisplayRemoved(display));
253 } 254 }
254 255
255 } // namespace views 256 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698