| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser_process_platform_part_chromeos.h" | 5 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 6 | 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/time/default_tick_clock.h" |
| 9 #include "base/time/tick_clock.h" |
| 7 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" | 10 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" |
| 8 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 11 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 12 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" |
| 9 | 13 |
| 10 BrowserProcessPlatformPart::BrowserProcessPlatformPart() | 14 BrowserProcessPlatformPart::BrowserProcessPlatformPart() |
| 11 : created_profile_helper_(false) { | 15 : created_profile_helper_(false) { |
| 12 } | 16 } |
| 13 | 17 |
| 14 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { | 18 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { |
| 15 } | 19 } |
| 16 | 20 |
| 21 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { |
| 22 DCHECK(!automatic_reboot_manager_); |
| 23 |
| 24 automatic_reboot_manager_.reset(new chromeos::system::AutomaticRebootManager( |
| 25 scoped_ptr<base::TickClock>(new base::DefaultTickClock))); |
| 26 } |
| 27 |
| 28 void BrowserProcessPlatformPart::ShutdownAutomaticRebootManager() { |
| 29 automatic_reboot_manager_.reset(); |
| 30 } |
| 31 |
| 17 chromeos::OomPriorityManager* | 32 chromeos::OomPriorityManager* |
| 18 BrowserProcessPlatformPart::oom_priority_manager() { | 33 BrowserProcessPlatformPart::oom_priority_manager() { |
| 19 DCHECK(CalledOnValidThread()); | 34 DCHECK(CalledOnValidThread()); |
| 20 if (!oom_priority_manager_.get()) | 35 if (!oom_priority_manager_.get()) |
| 21 oom_priority_manager_.reset(new chromeos::OomPriorityManager()); | 36 oom_priority_manager_.reset(new chromeos::OomPriorityManager()); |
| 22 return oom_priority_manager_.get(); | 37 return oom_priority_manager_.get(); |
| 23 } | 38 } |
| 24 | 39 |
| 25 chromeos::ProfileHelper* BrowserProcessPlatformPart::profile_helper() { | 40 chromeos::ProfileHelper* BrowserProcessPlatformPart::profile_helper() { |
| 26 DCHECK(CalledOnValidThread()); | 41 DCHECK(CalledOnValidThread()); |
| 27 if (!created_profile_helper_) | 42 if (!created_profile_helper_) |
| 28 CreateProfileHelper(); | 43 CreateProfileHelper(); |
| 29 return profile_helper_.get(); | 44 return profile_helper_.get(); |
| 30 } | 45 } |
| 31 | 46 |
| 32 void BrowserProcessPlatformPart::CreateProfileHelper() { | 47 void BrowserProcessPlatformPart::CreateProfileHelper() { |
| 33 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); | 48 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); |
| 34 created_profile_helper_ = true; | 49 created_profile_helper_ = true; |
| 35 profile_helper_.reset(new chromeos::ProfileHelper()); | 50 profile_helper_.reset(new chromeos::ProfileHelper()); |
| 36 } | 51 } |
| 37 | 52 |
| 38 void BrowserProcessPlatformPart::StartTearDown() { | 53 void BrowserProcessPlatformPart::StartTearDown() { |
| 39 profile_helper_.reset(); | 54 profile_helper_.reset(); |
| 40 } | 55 } |
| OLD | NEW |