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

Side by Side Diff: cc/output/begin_frame_args.h

Issue 2583483002: [cc] Adds source_id and sequence_number to BeginFrameArgs. (Closed)
Patch Set: fix field ordering Created 3 years, 12 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/ipc/cc_param_traits_macros.h ('k') | cc/output/begin_frame_args.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CC_OUTPUT_BEGIN_FRAME_ARGS_H_ 5 #ifndef CC_OUTPUT_BEGIN_FRAME_ARGS_H_
6 #define CC_OUTPUT_BEGIN_FRAME_ARGS_H_ 6 #define CC_OUTPUT_BEGIN_FRAME_ARGS_H_
7 7
8 #include <stdint.h>
8 #include <memory> 9 #include <memory>
9 10
10 #include "base/location.h" 11 #include "base/location.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "cc/base/cc_export.h" 15 #include "cc/base/cc_export.h"
15 16
16 namespace base { 17 namespace base {
17 namespace trace_event { 18 namespace trace_event {
(...skipping 24 matching lines...) Expand all
42 enum BeginFrameArgsType { 43 enum BeginFrameArgsType {
43 INVALID, 44 INVALID,
44 NORMAL, 45 NORMAL,
45 MISSED, 46 MISSED,
46 // Not a real type, but used by the IPC system. Should always remain the 47 // Not a real type, but used by the IPC system. Should always remain the
47 // *last* value in this enum. 48 // *last* value in this enum.
48 BEGIN_FRAME_ARGS_TYPE_MAX, 49 BEGIN_FRAME_ARGS_TYPE_MAX,
49 }; 50 };
50 static const char* TypeToString(BeginFrameArgsType type); 51 static const char* TypeToString(BeginFrameArgsType type);
51 52
53 static constexpr uint64_t kInvalidFrameNumber = 0;
54 static constexpr uint64_t kStartingFrameNumber = 1;
55
52 // Creates an invalid set of values. 56 // Creates an invalid set of values.
53 BeginFrameArgs(); 57 BeginFrameArgs();
54 58
55 #ifdef NDEBUG 59 #ifdef NDEBUG
56 typedef const void* CreationLocation; 60 typedef const void* CreationLocation;
57 #else 61 #else
58 typedef const tracked_objects::Location& CreationLocation; 62 typedef const tracked_objects::Location& CreationLocation;
59 tracked_objects::Location created_from; 63 tracked_objects::Location created_from;
60 #endif 64 #endif
61 65
62 // You should be able to find all instances where a BeginFrame has been 66 // You should be able to find all instances where a BeginFrame has been
63 // created by searching for "BeginFrameArgs::Create". 67 // created by searching for "BeginFrameArgs::Create".
64 // The location argument should **always** be BEGINFRAME_FROM_HERE macro. 68 // The location argument should **always** be BEGINFRAME_FROM_HERE macro.
65 static BeginFrameArgs Create(CreationLocation location, 69 static BeginFrameArgs Create(CreationLocation location,
70 uint32_t source_id,
71 uint64_t sequence_number,
66 base::TimeTicks frame_time, 72 base::TimeTicks frame_time,
67 base::TimeTicks deadline, 73 base::TimeTicks deadline,
68 base::TimeDelta interval, 74 base::TimeDelta interval,
69 BeginFrameArgsType type); 75 BeginFrameArgsType type);
70 76
71 // This is the default delta that will be used to adjust the deadline when 77 // This is the default delta that will be used to adjust the deadline when
72 // proper draw-time estimations are not yet available. 78 // proper draw-time estimations are not yet available.
73 static base::TimeDelta DefaultEstimatedParentDrawTime(); 79 static base::TimeDelta DefaultEstimatedParentDrawTime();
74 80
75 // This is the default interval to use to avoid sprinkling the code with 81 // This is the default interval to use to avoid sprinkling the code with
76 // magic numbers. 82 // magic numbers.
77 static base::TimeDelta DefaultInterval(); 83 static base::TimeDelta DefaultInterval();
78 84
79 bool IsValid() const { return interval >= base::TimeDelta(); } 85 bool IsValid() const { return interval >= base::TimeDelta(); }
80 86
81 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 87 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
82 void AsValueInto(base::trace_event::TracedValue* dict) const; 88 void AsValueInto(base::trace_event::TracedValue* dict) const;
83 89
84 base::TimeTicks frame_time; 90 base::TimeTicks frame_time;
85 base::TimeTicks deadline; 91 base::TimeTicks deadline;
86 base::TimeDelta interval; 92 base::TimeDelta interval;
93
94 // |source_id| and |sequence_number| identify a BeginFrame within a single
95 // process and are set by the original BeginFrameSource that created the
96 // BeginFrameArgs. When |source_id| of consecutive BeginFrameArgs changes,
97 // observers should expect the continuity of |sequence_number| to break.
98 uint64_t sequence_number;
99 uint32_t source_id; // |source_id| after |sequence_number| for packing.
100
87 BeginFrameArgsType type; 101 BeginFrameArgsType type;
88 bool on_critical_path; 102 bool on_critical_path;
89 103
90 private: 104 private:
91 BeginFrameArgs(base::TimeTicks frame_time, 105 BeginFrameArgs(uint32_t source_id,
106 uint64_t sequence_number,
107 base::TimeTicks frame_time,
92 base::TimeTicks deadline, 108 base::TimeTicks deadline,
93 base::TimeDelta interval, 109 base::TimeDelta interval,
94 BeginFrameArgsType type); 110 BeginFrameArgsType type);
95 }; 111 };
96 112
97 } // namespace cc 113 } // namespace cc
98 114
99 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ 115 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_
OLDNEW
« no previous file with comments | « cc/ipc/cc_param_traits_macros.h ('k') | cc/output/begin_frame_args.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698