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

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

Issue 735723005: cc: Adding creation location to debug BeginFrameArgs objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch without DEPS. Created 6 years, 1 month 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
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 6
7 #include "base/debug/trace_event_argument.h" 7 #include "base/debug/trace_event_argument.h"
8 #include "ui/gfx/frame_time.h" 8 #include "ui/gfx/frame_time.h"
9 9
10 namespace cc { 10 namespace cc {
(...skipping 23 matching lines...) Expand all
34 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time, 34 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time,
35 base::TimeTicks deadline, 35 base::TimeTicks deadline,
36 base::TimeDelta interval, 36 base::TimeDelta interval,
37 BeginFrameArgs::BeginFrameArgsType type) 37 BeginFrameArgs::BeginFrameArgsType type)
38 : frame_time(frame_time), 38 : frame_time(frame_time),
39 deadline(deadline), 39 deadline(deadline),
40 interval(interval), 40 interval(interval),
41 type(type) { 41 type(type) {
42 } 42 }
43 43
44 BeginFrameArgs BeginFrameArgs::Create(base::TimeTicks frame_time, 44 BeginFrameArgs BeginFrameArgs::Create(const tracked_objects::Location* location,
45 base::TimeTicks frame_time,
45 base::TimeTicks deadline, 46 base::TimeTicks deadline,
46 base::TimeDelta interval, 47 base::TimeDelta interval,
47 BeginFrameArgs::BeginFrameArgsType type) { 48 BeginFrameArgs::BeginFrameArgsType type) {
48 DCHECK_NE(type, BeginFrameArgs::INVALID); 49 DCHECK_NE(type, BeginFrameArgs::INVALID);
50 #ifdef NDEBUG
49 return BeginFrameArgs(frame_time, deadline, interval, type); 51 return BeginFrameArgs(frame_time, deadline, interval, type);
52 #else
53 BeginFrameArgs args = BeginFrameArgs(frame_time, deadline, interval, type);
54 args.created_by = *location;
55 delete location;
brianderson 2014/11/19 20:43:29 Would it be better to use a scoped_ptr instead of
mithro-old 2014/11/20 04:30:13 I tried to use a scope pointer but C++ is not smar
danakj 2014/11/20 16:02:19 It's not a matter of smarts. scoped_ptr is move-on
mithro-old 2014/11/21 05:57:46 Yes, scoped_ptr is move-only. The compiler should
danakj 2014/11/21 14:58:07 Why do you need to change the type to a void*? It
danakj 2014/11/21 15:03:43 Ah, I see what you've done. I don't really see the
56 return args;
57 #endif
50 } 58 }
51 59
52 scoped_refptr<base::debug::ConvertableToTraceFormat> BeginFrameArgs::AsValue() 60 scoped_refptr<base::debug::ConvertableToTraceFormat> BeginFrameArgs::AsValue()
53 const { 61 const {
54 scoped_refptr<base::debug::TracedValue> state = 62 scoped_refptr<base::debug::TracedValue> state =
55 new base::debug::TracedValue(); 63 new base::debug::TracedValue();
56 AsValueInto(state.get()); 64 AsValueInto(state.get());
57 return state; 65 return state;
58 } 66 }
59 67
60 void BeginFrameArgs::AsValueInto(base::debug::TracedValue* state) const { 68 void BeginFrameArgs::AsValueInto(base::debug::TracedValue* state) const {
61 state->SetString("type", "BeginFrameArgs"); 69 state->SetString("type", "BeginFrameArgs");
62 state->SetString("subtype", TypeToString(type)); 70 state->SetString("subtype", TypeToString(type));
63 state->SetDouble("frame_time_us", frame_time.ToInternalValue()); 71 state->SetDouble("frame_time_us", frame_time.ToInternalValue());
64 state->SetDouble("deadline_us", deadline.ToInternalValue()); 72 state->SetDouble("deadline_us", deadline.ToInternalValue());
65 state->SetDouble("interval_us", interval.InMicroseconds()); 73 state->SetDouble("interval_us", interval.InMicroseconds());
74 #ifndef NDEBUG
75 std::string created_by_str("");
76 created_by.Write(true, true, &created_by_str);
77 state->SetString("created_by", created_by_str);
78 #endif
66 } 79 }
67 80
68 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in 81 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in
69 // cases where a good estimated draw time is not known. Using 1/3 of the vsync 82 // cases where a good estimated draw time is not known. Using 1/3 of the vsync
70 // as the default adjustment gives the Browser the last 1/3 of a frame to 83 // as the default adjustment gives the Browser the last 1/3 of a frame to
71 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce 84 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce
72 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce 85 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce
73 // output. 86 // output.
74 base::TimeDelta BeginFrameArgs::DefaultEstimatedParentDrawTime() { 87 base::TimeDelta BeginFrameArgs::DefaultEstimatedParentDrawTime() {
75 return base::TimeDelta::FromMicroseconds(16666 / 3); 88 return base::TimeDelta::FromMicroseconds(16666 / 3);
76 } 89 }
77 90
78 base::TimeDelta BeginFrameArgs::DefaultInterval() { 91 base::TimeDelta BeginFrameArgs::DefaultInterval() {
79 return base::TimeDelta::FromMicroseconds(16666); 92 return base::TimeDelta::FromMicroseconds(16666);
80 } 93 }
81 94
82 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() { 95 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() {
83 return base::TimeDelta::FromMicroseconds(4444); 96 return base::TimeDelta::FromMicroseconds(4444);
84 } 97 }
85 98
86 } // namespace cc 99 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698