Commit b8fb0b71 authored by oshima's avatar oshima Committed by Commit bot

Don't dispatch event after shutdown on AshWTHUnified

in the same way as AshWTHX11/Ozone

Fixed minor error introduced when cleaning up CL

BUG=365662
TEST=UnifiedDesktopBasic will pass with real offscreen output surface

Review URL: https://codereview.chromium.org/1113493002

Cr-Commit-Position: refs/heads/master@{#327333}
parent 0aadb1da
......@@ -631,7 +631,9 @@ bool DisplayController::UpdateWorkAreaOfDisplayNearestWindow(
}
void DisplayController::OnDisplayAdded(const gfx::Display& display) {
if (GetDisplayManager()->IsInUnifiedMode()) {
#if defined(OS_CHROMEOS)
if (GetDisplayManager()->default_multi_display_mode() ==
DisplayManager::UNIFIED) {
if (primary_display_id == gfx::Display::kInvalidDisplayID)
primary_display_id = display.id();
AshWindowTreeHost* ash_host =
......@@ -642,13 +644,22 @@ void DisplayController::OnDisplayAdded(const gfx::Display& display) {
AshWindowTreeHost* to_delete = primary_tree_host_for_replace_;
primary_tree_host_for_replace_ = nullptr;
DeleteHost(to_delete);
#ifndef NDEBUG
auto iter = std::find_if(
window_tree_hosts_.begin(), window_tree_hosts_.end(),
[to_delete](const std::pair<int64, AshWindowTreeHost*>& pair) {
return pair.second == to_delete;
});
DCHECK(iter == window_tree_hosts_.end());
#endif
// the host has already been removed from the window_tree_host_.
}
}
// TODO(oshima): It should be possible to consolidate logic for
// unified and non unified, but I'm keeping them separated to minimize
// the risk in M44. I'll consolidate this in M45.
else if (primary_tree_host_for_replace_) {
} else
#endif
// TODO(oshima): It should be possible to consolidate logic for
// unified and non unified, but I'm keeping them separated to minimize
// the risk in M44. I'll consolidate this in M45.
if (primary_tree_host_for_replace_) {
DCHECK(window_tree_hosts_.empty());
primary_display_id = display.id();
window_tree_hosts_[display.id()] = primary_tree_host_for_replace_;
......
......@@ -145,7 +145,7 @@ void MirrorWindowController::UpdateWindow(
mirror_window->SetBounds(host->window()->bounds());
mirror_window->Show();
if (reflector_) {
// TODO(oshima): Enable this once reflect change is landed.
// TODO(oshima): Enable this once reflector change is landed.
// reflector_->AddMirroringLayer(mirror_window->layer());
} else {
reflector_ =
......@@ -267,7 +267,9 @@ void MirrorWindowController::CloseAndDeleteHost(MirroringHostInfo* host_info) {
host->RemoveObserver(Shell::GetInstance()->display_controller());
host->RemoveObserver(this);
// reflector_->RemoveMirroringLayer(host_info->mirror_window->layer());
host_info->ash_host->PrepareForShutdown();
// TODO(oshima): Enable this once reflector change is landed.
// reflector_->RemovedMirroringLayer(mirror_window->layer());
delete host_info;
}
......
......@@ -10,6 +10,7 @@
#include "ui/aura/window_targeter.h"
#include "ui/compositor/compositor.h"
#include "ui/events/event_processor.h"
#include "ui/events/null_event_targeter.h"
#include "ui/gfx/geometry/insets.h"
namespace ash {
......@@ -56,6 +57,9 @@ AshWindowTreeHostUnified::~AshWindowTreeHostUnified() {
}
void AshWindowTreeHostUnified::PrepareForShutdown() {
window()->SetEventTargeter(
scoped_ptr<ui::EventTargeter>(new ui::NullEventTargeter));
for (auto host : mirroring_hosts_)
host->PrepareForShutdown();
}
......
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