Commit b98e063c authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Do not log unnecessary message in IsDisplayIdValid

There is still a few cases it prints the warning when
it shouldn't. (in mirroring display scenario)
I'll address it in next CL.

Bug: None
Change-Id: Id254aab0788ab19f6ff970f495be98c7a0ee6e32
Reviewed-on: https://chromium-review.googlesource.com/c/1352032Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612944}
parent 126279af
......@@ -101,10 +101,11 @@ void PersistentWindowController::MaybeRestorePersistentWindowBounds() {
const int64_t persistent_display_id = persistent_window_info.display_id;
if (persistent_display_id == screen->GetDisplayNearestWindow(window).id())
continue;
const auto& display =
GetDisplayManager()->GetDisplayForId(persistent_display_id);
if (!display.is_valid())
auto* display_manager = GetDisplayManager();
if (!display_manager->IsDisplayIdValid(persistent_display_id))
continue;
const auto& display =
display_manager->GetDisplayForId(persistent_display_id);
// Update |persistent_window_bounds| based on |persistent_display_bounds|'s
// position change. This ensures that |persistent_window_bounds| is
......
......@@ -477,13 +477,19 @@ void DisplayManager::SetLayoutForCurrentDisplays(
}
const Display& DisplayManager::GetDisplayForId(int64_t display_id) const {
Display* display =
auto* display =
const_cast<DisplayManager*>(this)->FindDisplayForId(display_id);
// TODO(oshima): This happens when windows in unified desktop have
// been moved to a normal window. Fix this.
if (!display && display_id != kUnifiedDisplayId)
DLOG(ERROR) << "Could not find display:" << display_id;
return display ? *display : GetInvalidDisplay();
}
bool DisplayManager::IsDisplayIdValid(int64_t display_id) const {
return GetDisplayForId(display_id).is_valid();
Display* display =
const_cast<DisplayManager*>(this)->FindDisplayForId(display_id);
return !!display;
}
const Display& DisplayManager::FindDisplayContainingPoint(
......@@ -1994,10 +2000,6 @@ Display* DisplayManager::FindDisplayForId(int64_t id) {
[id](const Display& display) { return display.id() == id; });
if (iter != active_display_list_.end())
return &(*iter);
// TODO(oshima): This happens when windows in unified desktop have
// been moved to a normal window. Fix this.
if (id != kUnifiedDisplayId)
DLOG(ERROR) << "Could not find display:" << id;
return nullptr;
}
......
......@@ -514,7 +514,8 @@ class DISPLAY_MANAGER_EXPORT DisplayManager
// Same as above but for Unified Desktop.
void CreateUnifiedDesktopDisplayInfo(DisplayInfoList* display_info_list);
Display* FindDisplayForId(int64_t id);
// Finds an display for given |display_id|. Returns nullptr if not found.
Display* FindDisplayForId(int64_t display_id);
// Add the mirror display's display info if the software based mirroring is in
// use. This should only be called before UpdateDisplaysWith().
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment