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

Side by Side Diff: remoting/protocol/capture_scheduler.cc

Issue 2837863004: Use base::OneShotTimer instead of base::Timer(false, false)
Patch Set: rebase Created 3 years, 7 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 "remoting/protocol/capture_scheduler.h" 5 #include "remoting/protocol/capture_scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 28 matching lines...) Expand all
39 39
40 } // namespace 40 } // namespace
41 41
42 namespace remoting { 42 namespace remoting {
43 namespace protocol { 43 namespace protocol {
44 44
45 // We assume that the number of available cores is constant. 45 // We assume that the number of available cores is constant.
46 CaptureScheduler::CaptureScheduler(const base::Closure& capture_closure) 46 CaptureScheduler::CaptureScheduler(const base::Closure& capture_closure)
47 : capture_closure_(capture_closure), 47 : capture_closure_(capture_closure),
48 tick_clock_(new base::DefaultTickClock()), 48 tick_clock_(new base::DefaultTickClock()),
49 capture_timer_(new base::Timer(false, false)), 49 capture_timer_(new base::OneShotTimer),
50 minimum_interval_( 50 minimum_interval_(
51 base::TimeDelta::FromMilliseconds(kDefaultMinimumIntervalMs)), 51 base::TimeDelta::FromMilliseconds(kDefaultMinimumIntervalMs)),
52 num_of_processors_(base::SysInfo::NumberOfProcessors()), 52 num_of_processors_(base::SysInfo::NumberOfProcessors()),
53 capture_time_(kStatisticsWindow), 53 capture_time_(kStatisticsWindow),
54 encode_time_(kStatisticsWindow), 54 encode_time_(kStatisticsWindow),
55 num_encoding_frames_(0), 55 num_encoding_frames_(0),
56 num_unacknowledged_frames_(0), 56 num_unacknowledged_frames_(0),
57 capture_pending_(false), 57 capture_pending_(false),
58 is_paused_(false), 58 is_paused_(false),
59 next_frame_id_(0) { 59 next_frame_id_(0) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 DCHECK(!is_paused_); 175 DCHECK(!is_paused_);
176 DCHECK(!capture_pending_); 176 DCHECK(!capture_pending_);
177 177
178 capture_pending_ = true; 178 capture_pending_ = true;
179 last_capture_started_time_ = tick_clock_->NowTicks(); 179 last_capture_started_time_ = tick_clock_->NowTicks();
180 capture_closure_.Run(); 180 capture_closure_.Run();
181 } 181 }
182 182
183 } // namespace protocol 183 } // namespace protocol
184 } // namespace remoting 184 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/authenticator_test_base.cc ('k') | remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698