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

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

Issue 380763002: Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed memory leak found by Linux ASAN Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « cc/output/begin_frame_args.h ('k') | cc/output/filter_operation.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 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 #include "cc/output/begin_frame_args.h" 5 #include "cc/output/begin_frame_args.h"
6
7 #include "base/debug/trace_event_argument.h"
6 #include "ui/gfx/frame_time.h" 8 #include "ui/gfx/frame_time.h"
7 9
8 namespace cc { 10 namespace cc {
9 11
10 BeginFrameArgs::BeginFrameArgs() 12 BeginFrameArgs::BeginFrameArgs()
11 : frame_time(base::TimeTicks()), 13 : frame_time(base::TimeTicks()),
12 deadline(base::TimeTicks()), 14 deadline(base::TimeTicks()),
13 interval(base::TimeDelta::FromMicroseconds(-1)) { 15 interval(base::TimeDelta::FromMicroseconds(-1)) {
14 } 16 }
15 17
16 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time, 18 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time,
17 base::TimeTicks deadline, 19 base::TimeTicks deadline,
18 base::TimeDelta interval) 20 base::TimeDelta interval)
19 : frame_time(frame_time), 21 : frame_time(frame_time),
20 deadline(deadline), 22 deadline(deadline),
21 interval(interval) 23 interval(interval)
22 {} 24 {}
23 25
24 BeginFrameArgs BeginFrameArgs::Create(base::TimeTicks frame_time, 26 BeginFrameArgs BeginFrameArgs::Create(base::TimeTicks frame_time,
25 base::TimeTicks deadline, 27 base::TimeTicks deadline,
26 base::TimeDelta interval) { 28 base::TimeDelta interval) {
27 return BeginFrameArgs(frame_time, deadline, interval); 29 return BeginFrameArgs(frame_time, deadline, interval);
28 } 30 }
29 31
30 scoped_ptr<base::Value> BeginFrameArgs::AsValue() const { 32 scoped_refptr<base::debug::ConvertableToTraceFormat> BeginFrameArgs::AsValue()
31 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); 33 const {
34 scoped_refptr<base::debug::TracedValue> state =
35 new base::debug::TracedValue();
36 AsValueInto(state.get());
37 return state;
38 }
39
40 void BeginFrameArgs::AsValueInto(base::debug::TracedValue* state) const {
32 state->SetString("type", "BeginFrameArgs"); 41 state->SetString("type", "BeginFrameArgs");
33 state->SetDouble("frame_time_us", frame_time.ToInternalValue()); 42 state->SetDouble("frame_time_us", frame_time.ToInternalValue());
34 state->SetDouble("deadline_us", deadline.ToInternalValue()); 43 state->SetDouble("deadline_us", deadline.ToInternalValue());
35 state->SetDouble("interval_us", interval.InMicroseconds()); 44 state->SetDouble("interval_us", interval.InMicroseconds());
36 return state.PassAs<base::Value>();
37 } 45 }
38 46
39 BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor( 47 BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor(
40 base::TimeTicks now) { 48 base::TimeTicks now) {
41 // For WebView/SynchronousCompositor, we always want to draw immediately, 49 // For WebView/SynchronousCompositor, we always want to draw immediately,
42 // so we set the deadline to 0 and guess that the interval is 16 milliseconds. 50 // so we set the deadline to 0 and guess that the interval is 16 milliseconds.
43 if (now.is_null()) 51 if (now.is_null())
44 now = gfx::FrameTime::Now(); 52 now = gfx::FrameTime::Now();
45 return BeginFrameArgs(now, base::TimeTicks(), DefaultInterval()); 53 return BeginFrameArgs(now, base::TimeTicks(), DefaultInterval());
46 } 54 }
(...skipping 10 matching lines...) Expand all
57 65
58 base::TimeDelta BeginFrameArgs::DefaultInterval() { 66 base::TimeDelta BeginFrameArgs::DefaultInterval() {
59 return base::TimeDelta::FromMicroseconds(16666); 67 return base::TimeDelta::FromMicroseconds(16666);
60 } 68 }
61 69
62 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() { 70 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() {
63 return base::TimeDelta::FromMicroseconds(4444); 71 return base::TimeDelta::FromMicroseconds(4444);
64 } 72 }
65 73
66 } // namespace cc 74 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/begin_frame_args.h ('k') | cc/output/filter_operation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698