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

Side by Side Diff: cc/test/test_now_source.cc

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | « cc/test/test_now_source.h ('k') | cc/test/test_task_graph_runner.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <limits> 5 #include <limits>
6 #include <string> 6 #include <string>
7 7
8 #include "cc/test/test_now_source.h" 8 #include "cc/test/test_now_source.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 // TestNowSource::Constructors 12 // TestNowSource::Constructors
13 scoped_refptr<TestNowSource> TestNowSource::Create() { 13 scoped_refptr<TestNowSource> TestNowSource::Create() {
14 return make_scoped_refptr(new TestNowSource()); 14 return make_scoped_refptr(new TestNowSource());
15 } 15 }
16 16
17 scoped_refptr<TestNowSource> TestNowSource::Create(base::TimeTicks initial) { 17 scoped_refptr<TestNowSource> TestNowSource::Create(base::TimeTicks initial) {
18 return make_scoped_refptr(new TestNowSource(initial)); 18 return make_scoped_refptr(new TestNowSource(initial));
19 } 19 }
20 20
21 scoped_refptr<TestNowSource> TestNowSource::Create(int64_t initial) { 21 scoped_refptr<TestNowSource> TestNowSource::Create(int64_t initial) {
22 return make_scoped_refptr(new TestNowSource(initial)); 22 return make_scoped_refptr(new TestNowSource(initial));
23 } 23 }
24 24
25 TestNowSource::TestNowSource() 25 TestNowSource::TestNowSource()
26 : initial_(base::TimeTicks::FromInternalValue(10000)), now_() { 26 : initial_(base::TimeTicks::FromInternalValue(10000)),
27 now_(),
28 num_now_calls_(0) {
27 Reset(); 29 Reset();
28 } 30 }
29 31
30 TestNowSource::TestNowSource(base::TimeTicks initial) 32 TestNowSource::TestNowSource(base::TimeTicks initial)
31 : initial_(initial), now_() { 33 : initial_(initial), now_(), num_now_calls_(0) {
32 Reset(); 34 Reset();
33 } 35 }
34 36
35 TestNowSource::TestNowSource(int64_t initial) 37 TestNowSource::TestNowSource(int64_t initial)
36 : initial_(base::TimeTicks::FromInternalValue(initial)), now_() { 38 : initial_(base::TimeTicks::FromInternalValue(initial)),
39 now_(),
40 num_now_calls_(0) {
37 Reset(); 41 Reset();
38 } 42 }
39 43
40 TestNowSource::~TestNowSource() { 44 TestNowSource::~TestNowSource() {
41 } 45 }
42 46
43 // TestNowSource actual functionality 47 // TestNowSource actual functionality
44 void TestNowSource::Reset() { 48 void TestNowSource::Reset() {
45 TRACE_EVENT_INSTANT2("cc", 49 TRACE_EVENT_INSTANT2("cc",
46 "TestNowSource::Reset", 50 "TestNowSource::Reset",
47 TRACE_EVENT_SCOPE_THREAD, 51 TRACE_EVENT_SCOPE_THREAD,
48 "previous", 52 "previous",
49 now_, 53 now_,
50 "initial", 54 "initial",
51 initial_); 55 initial_);
52 now_ = initial_; 56 now_ = initial_;
53 } 57 }
54 58
55 base::TimeTicks TestNowSource::Now() const { 59 base::TimeTicks TestNowSource::Now() const {
60 num_now_calls_++;
56 return now_; 61 return now_;
57 } 62 }
58 63
59 void TestNowSource::SetNow(base::TimeTicks time) { 64 void TestNowSource::SetNow(base::TimeTicks time) {
60 TRACE_EVENT_INSTANT2("cc", 65 TRACE_EVENT_INSTANT2("cc",
61 "TestNowSource::SetNow", 66 "TestNowSource::SetNow",
62 TRACE_EVENT_SCOPE_THREAD, 67 TRACE_EVENT_SCOPE_THREAD,
63 "previous", 68 "previous",
64 now_, 69 now_,
65 "new", 70 "new",
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 ::std::ostream& operator<<(::std::ostream& os, 121 ::std::ostream& operator<<(::std::ostream& os,
117 const scoped_refptr<TestNowSource>& src) { 122 const scoped_refptr<TestNowSource>& src) {
118 os << src->ToString(); 123 os << src->ToString();
119 return os; 124 return os;
120 } 125 }
121 void PrintTo(const scoped_refptr<TestNowSource>& src, ::std::ostream* os) { 126 void PrintTo(const scoped_refptr<TestNowSource>& src, ::std::ostream* os) {
122 *os << src; 127 *os << src;
123 } 128 }
124 129
125 } // namespace cc 130 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_now_source.h ('k') | cc/test/test_task_graph_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698