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

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

Issue 2527283003: cc: Introduce BeginFrame sequence numbers and acknowledgements.
Patch Set: Address Brian's comments. Created 4 years 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/begin_frame_args_test.h ('k') | cc/test/begin_frame_source_test.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 "cc/test/begin_frame_args_test.h" 5 #include "cc/test/begin_frame_args_test.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/output/begin_frame_args.h" 10 #include "cc/output/begin_frame_args.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 BeginFrameArgs CreateBeginFrameArgsForTesting( 14 BeginFrameArgs CreateBeginFrameArgsForTesting(
15 BeginFrameArgs::CreationLocation location) { 15 BeginFrameArgs::CreationLocation location,
16 return CreateBeginFrameArgsForTesting(location, base::TimeTicks::Now()); 16 uint64_t source_id,
17 uint64_t sequence_number) {
18 return CreateBeginFrameArgsForTesting(location, source_id, sequence_number,
19 base::TimeTicks::Now());
17 } 20 }
18 21
19 BeginFrameArgs CreateBeginFrameArgsForTesting( 22 BeginFrameArgs CreateBeginFrameArgsForTesting(
20 BeginFrameArgs::CreationLocation location, 23 BeginFrameArgs::CreationLocation location,
24 uint64_t source_id,
25 uint64_t sequence_number,
21 base::TimeTicks frame_time) { 26 base::TimeTicks frame_time) {
22 return BeginFrameArgs::Create( 27 return BeginFrameArgs::Create(
23 location, frame_time, 28 location, source_id, sequence_number, frame_time,
24 frame_time + BeginFrameArgs::DefaultInterval() - 29 frame_time + BeginFrameArgs::DefaultInterval() -
25 BeginFrameArgs::DefaultEstimatedParentDrawTime(), 30 BeginFrameArgs::DefaultEstimatedParentDrawTime(),
26 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); 31 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL);
27 } 32 }
28 33
29 BeginFrameArgs CreateBeginFrameArgsForTesting( 34 BeginFrameArgs CreateBeginFrameArgsForTesting(
30 BeginFrameArgs::CreationLocation location, 35 BeginFrameArgs::CreationLocation location,
36 uint64_t source_id,
37 uint64_t sequence_number,
31 int64_t frame_time, 38 int64_t frame_time,
32 int64_t deadline, 39 int64_t deadline,
33 int64_t interval) { 40 int64_t interval) {
34 return BeginFrameArgs::Create( 41 return BeginFrameArgs::Create(location, source_id, sequence_number,
35 location, base::TimeTicks::FromInternalValue(frame_time), 42 base::TimeTicks::FromInternalValue(frame_time),
36 base::TimeTicks::FromInternalValue(deadline), 43 base::TimeTicks::FromInternalValue(deadline),
37 base::TimeDelta::FromInternalValue(interval), BeginFrameArgs::NORMAL); 44 base::TimeDelta::FromInternalValue(interval),
45 BeginFrameArgs::NORMAL);
38 } 46 }
39 47
40 BeginFrameArgs CreateBeginFrameArgsForTesting( 48 BeginFrameArgs CreateBeginFrameArgsForTesting(
41 BeginFrameArgs::CreationLocation location, 49 BeginFrameArgs::CreationLocation location,
50 uint64_t source_id,
51 uint64_t sequence_number,
42 int64_t frame_time, 52 int64_t frame_time,
43 int64_t deadline, 53 int64_t deadline,
44 int64_t interval, 54 int64_t interval,
45 BeginFrameArgs::BeginFrameArgsType type) { 55 BeginFrameArgs::BeginFrameArgsType type) {
46 return BeginFrameArgs::Create( 56 return BeginFrameArgs::Create(location, source_id, sequence_number,
47 location, base::TimeTicks::FromInternalValue(frame_time), 57 base::TimeTicks::FromInternalValue(frame_time),
48 base::TimeTicks::FromInternalValue(deadline), 58 base::TimeTicks::FromInternalValue(deadline),
49 base::TimeDelta::FromInternalValue(interval), type); 59 base::TimeDelta::FromInternalValue(interval),
60 type);
50 } 61 }
51 62
52 BeginFrameArgs CreateBeginFrameArgsForTesting( 63 BeginFrameArgs CreateBeginFrameArgsForTesting(
53 BeginFrameArgs::CreationLocation location, 64 BeginFrameArgs::CreationLocation location,
65 uint64_t source_id,
66 uint64_t sequence_number,
54 base::SimpleTestTickClock* now_src) { 67 base::SimpleTestTickClock* now_src) {
55 base::TimeTicks now = now_src->NowTicks(); 68 base::TimeTicks now = now_src->NowTicks();
56 return BeginFrameArgs::Create( 69 return BeginFrameArgs::Create(
57 location, now, now + BeginFrameArgs::DefaultInterval() - 70 location, source_id, sequence_number, now,
58 BeginFrameArgs::DefaultEstimatedParentDrawTime(), 71 now + BeginFrameArgs::DefaultInterval() -
72 BeginFrameArgs::DefaultEstimatedParentDrawTime(),
59 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); 73 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL);
60 } 74 }
61 75
62 bool operator==(const BeginFrameArgs& lhs, const BeginFrameArgs& rhs) { 76 bool operator==(const BeginFrameArgs& lhs, const BeginFrameArgs& rhs) {
63 return (lhs.type == rhs.type) && (lhs.frame_time == rhs.frame_time) && 77 return (lhs.type == rhs.type) && (lhs.source_id == rhs.source_id) &&
64 (lhs.deadline == rhs.deadline) && (lhs.interval == rhs.interval); 78 (lhs.sequence_number == rhs.sequence_number) &&
79 (lhs.frame_time == rhs.frame_time) && (lhs.deadline == rhs.deadline) &&
80 (lhs.interval == rhs.interval);
65 } 81 }
66 82
67 ::std::ostream& operator<<(::std::ostream& os, const BeginFrameArgs& args) { 83 ::std::ostream& operator<<(::std::ostream& os, const BeginFrameArgs& args) {
68 PrintTo(args, &os); 84 PrintTo(args, &os);
69 return os; 85 return os;
70 } 86 }
71 87
72 void PrintTo(const BeginFrameArgs& args, ::std::ostream* os) { 88 void PrintTo(const BeginFrameArgs& args, ::std::ostream* os) {
73 *os << "BeginFrameArgs(" << BeginFrameArgs::TypeToString(args.type) << ", " 89 *os << "BeginFrameArgs(" << BeginFrameArgs::TypeToString(args.type) << ", "
90 << args.source_id << ", " << args.sequence_number << ", "
74 << args.frame_time.ToInternalValue() << ", " 91 << args.frame_time.ToInternalValue() << ", "
75 << args.deadline.ToInternalValue() << ", " 92 << args.deadline.ToInternalValue() << ", "
76 << args.interval.InMicroseconds() << "us)"; 93 << args.interval.InMicroseconds() << "us)";
77 } 94 }
78 95
79 } // namespace cc 96 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/begin_frame_args_test.h ('k') | cc/test/begin_frame_source_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698