Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / chrome / browser / task_management / task_manager_observer.cc
blobcda0067393a9b850611dd9faf2f4f077895c3220
1 // Copyright 2015 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/task_management/task_manager_observer.h"
7 #include "chrome/browser/task_management/task_manager_interface.h"
9 namespace task_management {
11 TaskManagerObserver::TaskManagerObserver(base::TimeDelta refresh_time,
12 int64 resources_flags)
13 : observed_task_manager_(nullptr),
14 desired_refresh_time_(
15 refresh_time < base::TimeDelta::FromSeconds(1) ?
16 base::TimeDelta::FromSeconds(1) : refresh_time),
17 desired_resources_flags_(resources_flags) {
20 TaskManagerObserver::~TaskManagerObserver() {
23 void TaskManagerObserver::AddRefreshType(RefreshType type) {
24 desired_resources_flags_ |= type;
26 if (observed_task_manager_)
27 observed_task_manager_->RecalculateRefreshFlags();
30 void TaskManagerObserver::RemoveRefreshType(RefreshType type) {
31 desired_resources_flags_ &= ~type;
33 if (observed_task_manager_)
34 observed_task_manager_->RecalculateRefreshFlags();
38 } // namespace task_management