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
3 // found in the LICENSE file.
5 #include "chrome/browser/browser_process_platform_part_chromeos.h"
7 #include "base/logging.h"
8 #include "base/time/default_tick_clock.h"
9 #include "base/time/tick_clock.h"
10 #include "chrome/browser/chromeos/memory/oom_priority_manager.h"
11 #include "chrome/browser/chromeos/profiles/profile_helper.h"
12 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h"
14 BrowserProcessPlatformPart::BrowserProcessPlatformPart()
15 : created_profile_helper_(false) {
18 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() {
21 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() {
22 DCHECK(!automatic_reboot_manager_
);
24 automatic_reboot_manager_
.reset(new chromeos::system::AutomaticRebootManager(
25 scoped_ptr
<base::TickClock
>(new base::DefaultTickClock
)));
28 void BrowserProcessPlatformPart::ShutdownAutomaticRebootManager() {
29 automatic_reboot_manager_
.reset();
32 chromeos::OomPriorityManager
*
33 BrowserProcessPlatformPart::oom_priority_manager() {
34 DCHECK(CalledOnValidThread());
35 if (!oom_priority_manager_
.get())
36 oom_priority_manager_
.reset(new chromeos::OomPriorityManager());
37 return oom_priority_manager_
.get();
40 chromeos::ProfileHelper
* BrowserProcessPlatformPart::profile_helper() {
41 DCHECK(CalledOnValidThread());
42 if (!created_profile_helper_
)
43 CreateProfileHelper();
44 return profile_helper_
.get();
47 void BrowserProcessPlatformPart::CreateProfileHelper() {
48 DCHECK(!created_profile_helper_
&& profile_helper_
.get() == NULL
);
49 created_profile_helper_
= true;
50 profile_helper_
.reset(new chromeos::ProfileHelper());
53 void BrowserProcessPlatformPart::StartTearDown() {
54 profile_helper_
.reset();