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

Side by Side Diff: jingle/glue/pseudotcp_adapter_unittest.cc

Issue 864943002: Replaces instances of the deprecated TimeTicks::HighResNow() with TimeTicks::Now(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More changes based on review comments. Created 5 years, 11 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 | « gpu/command_buffer/tests/gl_query_unittest.cc ('k') | media/audio/clockless_audio_sink.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "jingle/glue/pseudotcp_adapter.h" 5 #include "jingle/glue/pseudotcp_adapter.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 28 matching lines...) Expand all
39 virtual bool DropNextPacket() = 0; 39 virtual bool DropNextPacket() = 0;
40 }; 40 };
41 41
42 class LeakyBucket : public RateLimiter { 42 class LeakyBucket : public RateLimiter {
43 public: 43 public:
44 // |rate| is in drops per second. 44 // |rate| is in drops per second.
45 LeakyBucket(double volume, double rate) 45 LeakyBucket(double volume, double rate)
46 : volume_(volume), 46 : volume_(volume),
47 rate_(rate), 47 rate_(rate),
48 level_(0.0), 48 level_(0.0),
49 last_update_(base::TimeTicks::HighResNow()) { 49 last_update_(base::TimeTicks::Now()) {
50 } 50 }
51 51
52 ~LeakyBucket() override {} 52 ~LeakyBucket() override {}
53 53
54 bool DropNextPacket() override { 54 bool DropNextPacket() override {
55 base::TimeTicks now = base::TimeTicks::HighResNow(); 55 base::TimeTicks now = base::TimeTicks::Now();
56 double interval = (now - last_update_).InSecondsF(); 56 double interval = (now - last_update_).InSecondsF();
57 last_update_ = now; 57 last_update_ = now;
58 level_ = level_ + 1.0 - interval * rate_; 58 level_ = level_ + 1.0 - interval * rate_;
59 if (level_ > volume_) { 59 if (level_ > volume_) {
60 level_ = volume_; 60 level_ = volume_;
61 return true; 61 return true;
62 } else if (level_ < 0.0) { 62 } else if (level_ < 0.0) {
63 level_ = 0.0; 63 level_ = 0.0;
64 } 64 }
65 return false; 65 return false;
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 client_pseudotcp_.get()); 435 client_pseudotcp_.get());
436 436
437 tester->Start(); 437 tester->Start();
438 message_loop_.Run(); 438 message_loop_.Run();
439 tester->CheckResults(); 439 tester->CheckResults();
440 } 440 }
441 441
442 } // namespace 442 } // namespace
443 443
444 } // namespace jingle_glue 444 } // namespace jingle_glue
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_query_unittest.cc ('k') | media/audio/clockless_audio_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698