| Index: content/browser/power_profiler/power_profiler_observer.cc
|
| diff --git a/content/browser/power_profiler/power_profiler_observer.cc b/content/browser/power_profiler/power_profiler_observer.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5c06ad86944fe79ea8ada7466a23861dc01cc309
|
| --- /dev/null
|
| +++ b/content/browser/power_profiler/power_profiler_observer.cc
|
| @@ -0,0 +1,42 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/public/browser/power_profiler_observer.h"
|
| +
|
| +#include "content/public/browser/browser_thread.h"
|
| +#include "content/public/browser/power_profiler_service.h"
|
| +
|
| +namespace content {
|
| +
|
| +PowerProfilerObserver::PowerProfilerObserver() : resolution_(NORMAL) {
|
| +}
|
| +
|
| +PowerProfilerObserver::~PowerProfilerObserver() {
|
| +}
|
| +
|
| +bool PowerProfilerObserver::Register() {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| +
|
| + if (!PowerProfilerService::GetInstance()->IsAvailable())
|
| + return false;
|
| +
|
| + PowerProfilerService::GetInstance()->AddObserver(this);
|
| +
|
| + return true;
|
| +}
|
| +
|
| +void PowerProfilerObserver::Unregister() {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| +
|
| + PowerProfilerService::GetInstance()->RemoveObserver(this);
|
| +}
|
| +
|
| +void PowerProfilerObserver::SetResolution(Resolution resolution) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| +
|
| + resolution_ = resolution;
|
| + PowerProfilerService::GetInstance()->UpdateResolution();
|
| +}
|
| +
|
| +} // namespace content
|
|
|