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

Side by Side Diff: cc/animation/animation.cc

Issue 641903003: cc: Remove main-thread tracing of animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/animation/animation.h" 5 #include "cc/animation/animation.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 void Animation::SetRunState(RunState run_state, 85 void Animation::SetRunState(RunState run_state,
86 base::TimeTicks monotonic_time) { 86 base::TimeTicks monotonic_time) {
87 if (suspended_) 87 if (suspended_)
88 return; 88 return;
89 89
90 char name_buffer[256]; 90 char name_buffer[256];
91 base::snprintf(name_buffer, 91 base::snprintf(name_buffer,
92 sizeof(name_buffer), 92 sizeof(name_buffer),
93 "%s-%d%s", 93 "%s-%d",
94 s_targetPropertyNames[target_property_], 94 s_targetPropertyNames[target_property_],
95 group_, 95 group_);
96 is_controlling_instance_ ? "(impl)" : "");
97 96
98 bool is_waiting_to_start = run_state_ == WaitingForTargetAvailability || 97 bool is_waiting_to_start = run_state_ == WaitingForTargetAvailability ||
99 run_state_ == Starting; 98 run_state_ == Starting;
100 99
101 if (is_waiting_to_start && run_state == Running) { 100 if (is_controlling_instance_ && is_waiting_to_start && run_state == Running) {
102 TRACE_EVENT_ASYNC_BEGIN1( 101 TRACE_EVENT_ASYNC_BEGIN1(
103 "cc", "Animation", this, "Name", TRACE_STR_COPY(name_buffer)); 102 "cc", "Animation", this, "Name", TRACE_STR_COPY(name_buffer));
104 } 103 }
105 104
106 bool was_finished = is_finished(); 105 bool was_finished = is_finished();
107 106
108 const char* old_run_state_name = s_runStateNames[run_state_]; 107 const char* old_run_state_name = s_runStateNames[run_state_];
109 108
110 if (run_state == Running && run_state_ == Paused) 109 if (run_state == Running && run_state_ == Paused)
111 total_paused_time_ += (monotonic_time - pause_time_); 110 total_paused_time_ += (monotonic_time - pause_time_);
112 else if (run_state == Paused) 111 else if (run_state == Paused)
113 pause_time_ = monotonic_time; 112 pause_time_ = monotonic_time;
114 run_state_ = run_state; 113 run_state_ = run_state;
115 114
116 const char* new_run_state_name = s_runStateNames[run_state]; 115 const char* new_run_state_name = s_runStateNames[run_state];
117 116
118 if (!was_finished && is_finished()) 117 if (is_controlling_instance_ && !was_finished && is_finished())
119 TRACE_EVENT_ASYNC_END0("cc", "Animation", this); 118 TRACE_EVENT_ASYNC_END0("cc", "Animation", this);
120 119
121 char state_buffer[256]; 120 char state_buffer[256];
122 base::snprintf(state_buffer, 121 base::snprintf(state_buffer,
123 sizeof(state_buffer), 122 sizeof(state_buffer),
124 "%s->%s", 123 "%s->%s",
125 old_run_state_name, 124 old_run_state_name,
126 new_run_state_name); 125 new_run_state_name);
127 126
128 TRACE_EVENT_INSTANT2("cc", 127 TRACE_EVENT_INSTANT2("cc",
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // the main thread. 274 // the main thread.
276 if (run_state_ == Animation::Paused || 275 if (run_state_ == Animation::Paused ||
277 other->run_state_ == Animation::Paused) { 276 other->run_state_ == Animation::Paused) {
278 other->run_state_ = run_state_; 277 other->run_state_ = run_state_;
279 other->pause_time_ = pause_time_; 278 other->pause_time_ = pause_time_;
280 other->total_paused_time_ = total_paused_time_; 279 other->total_paused_time_ = total_paused_time_;
281 } 280 }
282 } 281 }
283 282
284 } // namespace cc 283 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698