| OLD | NEW |
| 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 "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 ChromeLauncherController::instance(); | 328 ChromeLauncherController::instance(); |
| 329 DCHECK(chrome_controller || !ash::Shell::HasInstance()); | 329 DCHECK(chrome_controller || !ash::Shell::HasInstance()); |
| 330 if (chrome_controller) { | 330 if (chrome_controller) { |
| 331 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch( | 331 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch( |
| 332 app_id, event_flags); | 332 app_id, event_flags); |
| 333 | 333 |
| 334 // On some boards, ARC is booted with a restricted set of resources by | 334 // On some boards, ARC is booted with a restricted set of resources by |
| 335 // default to avoid slowing down Chrome's user session restoration. | 335 // default to avoid slowing down Chrome's user session restoration. |
| 336 // However, the restriction should be lifted once the user explicitly | 336 // However, the restriction should be lifted once the user explicitly |
| 337 // tries to launch an ARC app. | 337 // tries to launch an ARC app. |
| 338 VLOG(2) << "Prioritizing the instance"; | 338 PrioritizeArcContainerStartup(); |
| 339 chromeos::SessionManagerClient* session_manager_client = | |
| 340 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); | |
| 341 session_manager_client->SetArcCpuRestriction( | |
| 342 login_manager::CONTAINER_CPU_RESTRICTION_FOREGROUND, | |
| 343 base::Bind(SetArcCpuRestrictionCallback)); | |
| 344 } | 339 } |
| 345 prefs->SetLastLaunchTime(app_id, base::Time::Now()); | 340 prefs->SetLastLaunchTime(app_id, base::Time::Now()); |
| 346 return true; | 341 return true; |
| 347 } | 342 } |
| 348 return (new LaunchAppWithoutSize(context, app_id, landscape_layout, | 343 return (new LaunchAppWithoutSize(context, app_id, landscape_layout, |
| 349 event_flags)) | 344 event_flags)) |
| 350 ->LaunchAndRelease(); | 345 ->LaunchAndRelease(); |
| 351 } | 346 } |
| 352 | 347 |
| 353 void SetTaskActive(int task_id) { | 348 void SetTaskActive(int task_id) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 if (id.empty()) | 464 if (id.empty()) |
| 470 return false; | 465 return false; |
| 471 | 466 |
| 472 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); | 467 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); |
| 473 if (!arc_prefs) | 468 if (!arc_prefs) |
| 474 return false; | 469 return false; |
| 475 | 470 |
| 476 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); | 471 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); |
| 477 } | 472 } |
| 478 | 473 |
| 474 void PrioritizeArcContainerStartup() { |
| 475 VLOG(2) << "Prioritizing the instance"; |
| 476 chromeos::SessionManagerClient* session_manager_client = |
| 477 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); |
| 478 session_manager_client->SetArcCpuRestriction( |
| 479 login_manager::CONTAINER_CPU_RESTRICTION_FOREGROUND, |
| 480 base::Bind(SetArcCpuRestrictionCallback)); |
| 481 } |
| 482 |
| 479 } // namespace arc | 483 } // namespace arc |
| OLD | NEW |