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

Side by Side Diff: chrome/browser/chromeos/login/app_launch_controller.cc

Issue 982993002: Tentative fix for the crash when calling StartupAppLauncher::ContinueWithNetworkReady by clear the … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear network wait timer before starting launch_splash_timer. Created 5 years, 9 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 | « chrome/browser/chromeos/login/app_launch_controller.h ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/login/app_launch_controller.h" 5 #include "chrome/browser/chromeos/login/app_launch_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 startup_app_launcher_.reset( 259 startup_app_launcher_.reset(
260 new StartupAppLauncher(profile_, app_id_, diagnostic_mode_, this)); 260 new StartupAppLauncher(profile_, app_id_, diagnostic_mode_, this));
261 startup_app_launcher_->Initialize(); 261 startup_app_launcher_->Initialize();
262 } 262 }
263 263
264 void AppLaunchController::OnProfileLoadFailed( 264 void AppLaunchController::OnProfileLoadFailed(
265 KioskAppLaunchError::Error error) { 265 KioskAppLaunchError::Error error) {
266 OnLaunchFailed(error); 266 OnLaunchFailed(error);
267 } 267 }
268 268
269 void AppLaunchController::ClearNetworkWaitTimer() {
270 waiting_for_network_ = false;
271 network_wait_timer_.Stop();
272 }
273
269 void AppLaunchController::CleanUp() { 274 void AppLaunchController::CleanUp() {
275 ClearNetworkWaitTimer();
270 kiosk_profile_loader_.reset(); 276 kiosk_profile_loader_.reset();
271 startup_app_launcher_.reset(); 277 startup_app_launcher_.reset();
272 splash_wait_timer_.Stop(); 278 splash_wait_timer_.Stop();
273 279
274 if (host_) 280 if (host_)
275 host_->Finalize(); 281 host_->Finalize();
276 } 282 }
277 283
278 void AppLaunchController::OnNetworkWaitTimedout() { 284 void AppLaunchController::OnNetworkWaitTimedout() {
279 DCHECK(waiting_for_network_); 285 DCHECK(waiting_for_network_);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 369
364 void AppLaunchController::OnInitializingTokenService() { 370 void AppLaunchController::OnInitializingTokenService() {
365 app_launch_splash_screen_actor_->UpdateAppLaunchState( 371 app_launch_splash_screen_actor_->UpdateAppLaunchState(
366 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_LOADING_TOKEN_SERVICE); 372 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_LOADING_TOKEN_SERVICE);
367 } 373 }
368 374
369 void AppLaunchController::OnInstallingApp() { 375 void AppLaunchController::OnInstallingApp() {
370 app_launch_splash_screen_actor_->UpdateAppLaunchState( 376 app_launch_splash_screen_actor_->UpdateAppLaunchState(
371 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_INSTALLING_APPLICATION); 377 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_INSTALLING_APPLICATION);
372 378
373 waiting_for_network_ = false; 379 ClearNetworkWaitTimer();
374 network_wait_timer_.Stop();
375 app_launch_splash_screen_actor_->ToggleNetworkConfig(false); 380 app_launch_splash_screen_actor_->ToggleNetworkConfig(false);
376 381
377 // We have connectivity at this point, so we can skip the network 382 // We have connectivity at this point, so we can skip the network
378 // configuration dialog if it is being shown. 383 // configuration dialog if it is being shown.
379 if (showing_network_dialog_) { 384 if (showing_network_dialog_) {
380 app_launch_splash_screen_actor_->Show(app_id_); 385 app_launch_splash_screen_actor_->Show(app_id_);
381 showing_network_dialog_ = false; 386 showing_network_dialog_ = false;
382 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); 387 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue();
383 } 388 }
384 } 389 }
385 390
386 void AppLaunchController::OnReadyToLaunch() { 391 void AppLaunchController::OnReadyToLaunch() {
387 launcher_ready_ = true; 392 launcher_ready_ = true;
388 393
389 if (network_config_requested_) 394 if (network_config_requested_)
390 return; 395 return;
391 396
392 if (!webui_visible_) 397 if (!webui_visible_)
393 return; 398 return;
394 399
395 if (splash_wait_timer_.IsRunning()) 400 if (splash_wait_timer_.IsRunning())
396 return; 401 return;
397 402
403 ClearNetworkWaitTimer();
404
398 const int64 time_taken_ms = (base::TimeTicks::Now() - 405 const int64 time_taken_ms = (base::TimeTicks::Now() -
399 base::TimeTicks::FromInternalValue(launch_splash_start_time_)). 406 base::TimeTicks::FromInternalValue(launch_splash_start_time_)).
400 InMilliseconds(); 407 InMilliseconds();
401 408
402 // Enforce that we show app install splash screen for some minimum amount 409 // Enforce that we show app install splash screen for some minimum amount
403 // of time. 410 // of time.
404 if (!skip_splash_wait_ && time_taken_ms < kAppInstallSplashScreenMinTimeMS) { 411 if (!skip_splash_wait_ && time_taken_ms < kAppInstallSplashScreenMinTimeMS) {
405 splash_wait_timer_.Start( 412 splash_wait_timer_.Start(
406 FROM_HERE, 413 FROM_HERE,
407 base::TimeDelta::FromMilliseconds( 414 base::TimeDelta::FromMilliseconds(
(...skipping 24 matching lines...) Expand all
432 KioskAppLaunchError::Save(error); 439 KioskAppLaunchError::Save(error);
433 chrome::AttemptUserExit(); 440 chrome::AttemptUserExit();
434 CleanUp(); 441 CleanUp();
435 } 442 }
436 443
437 bool AppLaunchController::IsShowingNetworkConfigScreen() { 444 bool AppLaunchController::IsShowingNetworkConfigScreen() {
438 return network_config_requested_; 445 return network_config_requested_;
439 } 446 }
440 447
441 } // namespace chromeos 448 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/app_launch_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698