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

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

Issue 270703004: Making BeginFrameArgs work with TRACE_EVENT system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Using AsValue rather than StateAsValue. Created 6 years, 7 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
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 "base/json/json_writer.h"
5 #include "cc/output/begin_frame_args.h" 6 #include "cc/output/begin_frame_args.h"
6 #include "ui/gfx/frame_time.h" 7 #include "ui/gfx/frame_time.h"
7 8
8 namespace cc { 9 namespace cc {
9 10
10 BeginFrameArgs::BeginFrameArgs() 11 BeginFrameArgs::BeginFrameArgs()
11 : frame_time(base::TimeTicks()), 12 : frame_time(base::TimeTicks()),
12 deadline(base::TimeTicks()), 13 deadline(base::TimeTicks()),
13 interval(base::TimeDelta::FromMicroseconds(-1)) { 14 interval(base::TimeDelta::FromMicroseconds(-1)) {
14 } 15 }
15 16
16 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time, 17 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time,
17 base::TimeTicks deadline, 18 base::TimeTicks deadline,
18 base::TimeDelta interval) 19 base::TimeDelta interval)
19 : frame_time(frame_time), 20 : frame_time(frame_time),
20 deadline(deadline), 21 deadline(deadline),
21 interval(interval) 22 interval(interval)
22 {} 23 {}
23 24
24 BeginFrameArgs BeginFrameArgs::Create(base::TimeTicks frame_time, 25 BeginFrameArgs BeginFrameArgs::Create(base::TimeTicks frame_time,
25 base::TimeTicks deadline, 26 base::TimeTicks deadline,
26 base::TimeDelta interval) { 27 base::TimeDelta interval) {
27 return BeginFrameArgs(frame_time, deadline, interval); 28 return BeginFrameArgs(frame_time, deadline, interval);
28 } 29 }
29 30
31 scoped_ptr<base::Value> BeginFrameArgs::AsValue() const {
32 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue);
33 state->SetString("type", "BeginFrameArgs");
34 state->SetDouble("frame_time_us", frame_time.ToInternalValue());
35 state->SetDouble("deadline_us", deadline.ToInternalValue());
36 state->SetDouble("interval_us", interval.InMicroseconds());
37 return state.PassAs<base::Value>();
38 }
39
30 BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor() { 40 BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor() {
31 // For WebView/SynchronousCompositor, we always want to draw immediately, 41 // For WebView/SynchronousCompositor, we always want to draw immediately,
32 // so we set the deadline to 0 and guess that the interval is 16 milliseconds. 42 // so we set the deadline to 0 and guess that the interval is 16 milliseconds.
33 return BeginFrameArgs(gfx::FrameTime::Now(), 43 return BeginFrameArgs(gfx::FrameTime::Now(),
34 base::TimeTicks(), 44 base::TimeTicks(),
35 DefaultInterval()); 45 DefaultInterval());
36 } 46 }
37 47
38 BeginFrameArgs BeginFrameArgs::CreateForTesting() { 48 BeginFrameArgs BeginFrameArgs::CreateForTesting() {
39 base::TimeTicks now = gfx::FrameTime::Now(); 49 base::TimeTicks now = gfx::FrameTime::Now();
(...skipping 21 matching lines...) Expand all
61 71
62 base::TimeDelta BeginFrameArgs::DefaultInterval() { 72 base::TimeDelta BeginFrameArgs::DefaultInterval() {
63 return base::TimeDelta::FromMicroseconds(16666); 73 return base::TimeDelta::FromMicroseconds(16666);
64 } 74 }
65 75
66 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() { 76 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() {
67 return base::TimeDelta::FromMicroseconds(4444); 77 return base::TimeDelta::FromMicroseconds(4444);
68 } 78 }
69 79
70 } // namespace cc 80 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698