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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/thread_load_tracker.cc

Issue 2693953005: [scheduler] Disable background thread load tracker by default. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/thread_load_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/scheduler/base/thread_load_tracker.h" 5 #include "platform/scheduler/base/thread_load_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 namespace blink { 9 namespace blink {
10 namespace scheduler { 10 namespace scheduler {
11 11
12 ThreadLoadTracker::ThreadLoadTracker(base::TimeTicks now, 12 ThreadLoadTracker::ThreadLoadTracker(base::TimeTicks now,
13 const Callback& callback, 13 const Callback& callback,
14 base::TimeDelta reporting_interval, 14 base::TimeDelta reporting_interval,
15 base::TimeDelta waiting_period) 15 base::TimeDelta waiting_period)
16 : time_(now), 16 : time_(now),
17 thread_state_(ThreadState::ACTIVE), 17 thread_state_(ThreadState::PAUSED),
18 last_state_change_time_(now), 18 last_state_change_time_(now),
19 waiting_period_(waiting_period), 19 waiting_period_(waiting_period),
20 reporting_interval_(reporting_interval), 20 reporting_interval_(reporting_interval),
21 callback_(callback) { 21 callback_(callback) {
22 next_reporting_time_ = now + waiting_period_; 22 next_reporting_time_ = now + waiting_period_;
23 } 23 }
24 24
25 ThreadLoadTracker::~ThreadLoadTracker() {} 25 ThreadLoadTracker::~ThreadLoadTracker() {}
26 26
27 void ThreadLoadTracker::Pause(base::TimeTicks now) { 27 void ThreadLoadTracker::Pause(base::TimeTicks now) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 } 116 }
117 117
118 double ThreadLoadTracker::Load() { 118 double ThreadLoadTracker::Load() {
119 return run_time_inside_window_.InSecondsF() / 119 return run_time_inside_window_.InSecondsF() /
120 reporting_interval_.InSecondsF(); 120 reporting_interval_.InSecondsF();
121 } 121 }
122 122
123 } // namespace scheduler 123 } // namespace scheduler
124 } // namespace blink 124 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/thread_load_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698