Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: chrome/browser/task_management/task_manager_interface.cc

Issue 1545223002: Switch to standard integer types in chrome/browser/, part 4 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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/task_management/task_manager_interface.h" 5 #include "chrome/browser/task_management/task_manager_interface.h"
6 6
7 #include "chrome/browser/task_management/sampling/task_manager_impl.h" 7 #include "chrome/browser/task_management/sampling/task_manager_impl.h"
8 #include "chrome/browser/task_management/sampling/task_manager_io_thread_helper. h" 8 #include "chrome/browser/task_management/sampling/task_manager_io_thread_helper. h"
9 #include "chrome/browser/task_manager/task_manager.h" 9 #include "chrome/browser/task_manager/task_manager.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // to be added). 50 // to be added).
51 // Reset the refresh timer. 51 // Reset the refresh timer.
52 ScheduleRefresh(observer->desired_refresh_time()); 52 ScheduleRefresh(observer->desired_refresh_time());
53 } 53 }
54 54
55 void TaskManagerInterface::RemoveObserver(TaskManagerObserver* observer) { 55 void TaskManagerInterface::RemoveObserver(TaskManagerObserver* observer) {
56 observers_.RemoveObserver(observer); 56 observers_.RemoveObserver(observer);
57 observer->observed_task_manager_ = nullptr; 57 observer->observed_task_manager_ = nullptr;
58 58
59 // Recalculate the minimum refresh rate and the enabled resource flags. 59 // Recalculate the minimum refresh rate and the enabled resource flags.
60 int64 flags = 0; 60 int64_t flags = 0;
61 base::TimeDelta min_time = base::TimeDelta::Max(); 61 base::TimeDelta min_time = base::TimeDelta::Max();
62 base::ObserverList<TaskManagerObserver>::Iterator itr(&observers_); 62 base::ObserverList<TaskManagerObserver>::Iterator itr(&observers_);
63 while (TaskManagerObserver* obs = itr.GetNext()) { 63 while (TaskManagerObserver* obs = itr.GetNext()) {
64 if (obs->desired_refresh_time() < min_time) 64 if (obs->desired_refresh_time() < min_time)
65 min_time = obs->desired_refresh_time(); 65 min_time = obs->desired_refresh_time();
66 66
67 flags |= obs->desired_resources_flags(); 67 flags |= obs->desired_resources_flags();
68 } 68 }
69 69
70 if (min_time == base::TimeDelta::Max()) { 70 if (min_time == base::TimeDelta::Max()) {
71 // This is the last observer to be removed. Stop updating. 71 // This is the last observer to be removed. Stop updating.
72 SetEnabledResourceFlags(0); 72 SetEnabledResourceFlags(0);
73 refresh_timer_->Stop(); 73 refresh_timer_->Stop();
74 StopUpdating(); 74 StopUpdating();
75 } else { 75 } else {
76 SetEnabledResourceFlags(flags); 76 SetEnabledResourceFlags(flags);
77 ScheduleRefresh(min_time); 77 ScheduleRefresh(min_time);
78 } 78 }
79 } 79 }
80 80
81 void TaskManagerInterface::RecalculateRefreshFlags() { 81 void TaskManagerInterface::RecalculateRefreshFlags() {
82 int64 flags = 0; 82 int64_t flags = 0;
83 base::ObserverList<TaskManagerObserver>::Iterator itr(&observers_); 83 base::ObserverList<TaskManagerObserver>::Iterator itr(&observers_);
84 while (TaskManagerObserver* obs = itr.GetNext()) 84 while (TaskManagerObserver* obs = itr.GetNext())
85 flags |= obs->desired_resources_flags(); 85 flags |= obs->desired_resources_flags();
86 86
87 SetEnabledResourceFlags(flags); 87 SetEnabledResourceFlags(flags);
88 } 88 }
89 89
90 bool TaskManagerInterface::IsResourceRefreshEnabled(RefreshType type) { 90 bool TaskManagerInterface::IsResourceRefreshEnabled(RefreshType type) {
91 return (enabled_resources_flags_ & type) != 0; 91 return (enabled_resources_flags_ & type) != 0;
92 } 92 }
(...skipping 20 matching lines...) Expand all
113 FOR_EACH_OBSERVER(TaskManagerObserver, 113 FOR_EACH_OBSERVER(TaskManagerObserver,
114 observers_, 114 observers_,
115 OnTasksRefreshed(task_ids)); 115 OnTasksRefreshed(task_ids));
116 } 116 }
117 117
118 base::TimeDelta TaskManagerInterface::GetCurrentRefreshTime() const { 118 base::TimeDelta TaskManagerInterface::GetCurrentRefreshTime() const {
119 return refresh_timer_->IsRunning() ? refresh_timer_->GetCurrentDelay() 119 return refresh_timer_->IsRunning() ? refresh_timer_->GetCurrentDelay()
120 : base::TimeDelta::Max(); 120 : base::TimeDelta::Max();
121 } 121 }
122 122
123 void TaskManagerInterface::ResourceFlagsAdded(int64 flags) { 123 void TaskManagerInterface::ResourceFlagsAdded(int64_t flags) {
124 enabled_resources_flags_ |= flags; 124 enabled_resources_flags_ |= flags;
125 } 125 }
126 126
127 void TaskManagerInterface::SetEnabledResourceFlags(int64 flags) { 127 void TaskManagerInterface::SetEnabledResourceFlags(int64_t flags) {
128 enabled_resources_flags_ = flags; 128 enabled_resources_flags_ = flags;
129 } 129 }
130 130
131 void TaskManagerInterface::ScheduleRefresh(base::TimeDelta refresh_time) { 131 void TaskManagerInterface::ScheduleRefresh(base::TimeDelta refresh_time) {
132 refresh_timer_->Start(FROM_HERE, 132 refresh_timer_->Start(FROM_HERE,
133 refresh_time, 133 refresh_time,
134 base::Bind(&TaskManagerInterface::Refresh, 134 base::Bind(&TaskManagerInterface::Refresh,
135 base::Unretained(this))); 135 base::Unretained(this)));
136 } 136 }
137 137
138 } // namespace task_management 138 } // namespace task_management
OLDNEW
« no previous file with comments | « chrome/browser/task_management/task_manager_interface.h ('k') | chrome/browser/task_management/task_manager_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698