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

Side by Side Diff: chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc

Issue 2259403002: arc: Fix crash on window close (on close race condition). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc » ('j') | 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 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" 4 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h"
5 5
6 #include <string> 6 #include <string>
7 7
8 #include "ash/common/wm/window_state.h" 8 #include "ash/common/wm/window_state.h"
9 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 } 331 }
332 332
333 void ArcAppWindowLauncherController::OnWindowDestroying(aura::Window* window) { 333 void ArcAppWindowLauncherController::OnWindowDestroying(aura::Window* window) {
334 auto it = 334 auto it =
335 std::find(observed_windows_.begin(), observed_windows_.end(), window); 335 std::find(observed_windows_.begin(), observed_windows_.end(), window);
336 DCHECK(it != observed_windows_.end()); 336 DCHECK(it != observed_windows_.end());
337 observed_windows_.erase(it); 337 observed_windows_.erase(it);
338 window->RemoveObserver(this); 338 window->RemoveObserver(this);
339 339
340 for (auto& it : task_id_to_app_window_) { 340 for (auto& it : task_id_to_app_window_) {
341 if (it.second->widget() == views::Widget::GetWidgetForNativeWindow(window)) 341 if (it.second->GetNativeWindow() == window) {
342 it.second->set_widget(nullptr); 342 OnTaskDestroyed(it.second->task_id());
343 break;
344 }
343 } 345 }
344 } 346 }
345 347
346 ArcAppWindowLauncherController::AppWindow* 348 ArcAppWindowLauncherController::AppWindow*
347 ArcAppWindowLauncherController::GetAppWindowForTask(int task_id) { 349 ArcAppWindowLauncherController::GetAppWindowForTask(int task_id) {
348 TaskIdToAppWindow::iterator it = task_id_to_app_window_.find(task_id); 350 TaskIdToAppWindow::iterator it = task_id_to_app_window_.find(task_id);
349 if (it == task_id_to_app_window_.end()) 351 if (it == task_id_to_app_window_.end())
350 return nullptr; 352 return nullptr;
351 return it->second.get(); 353 return it->second.get();
352 } 354 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 634
633 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { 635 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) {
634 // Resolve the orientation when it first resolved. 636 // Resolve the orientation when it first resolved.
635 orientation_lock = GetCurrentOrientation(); 637 orientation_lock = GetCurrentOrientation();
636 app_window->set_requested_orientation_lock(orientation_lock); 638 app_window->set_requested_orientation_lock(orientation_lock);
637 } 639 }
638 640
639 shell->screen_orientation_controller()->LockOrientationForWindow( 641 shell->screen_orientation_controller()->LockOrientationForWindow(
640 window, BlinkOrientationLockFromMojom(orientation_lock)); 642 window, BlinkOrientationLockFromMojom(orientation_lock));
641 } 643 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698