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

Side by Side Diff: third_party/WebKit/Source/platform/Timer.cpp

Issue 2406703002: tracing: remove sampling state profiler (Closed)
Patch Set: . Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return; 120 return;
121 121
122 m_weakPtrFactory.revokeAll(); 122 m_weakPtrFactory.revokeAll();
123 123
124 TRACE_EVENT0("blink", "TimerBase::run"); 124 TRACE_EVENT0("blink", "TimerBase::run");
125 #if DCHECK_IS_ON() 125 #if DCHECK_IS_ON()
126 DCHECK_EQ(m_thread, currentThread()) 126 DCHECK_EQ(m_thread, currentThread())
127 << "Timer posted by " << m_location.function_name() << " " 127 << "Timer posted by " << m_location.function_name() << " "
128 << m_location.file_name() << " was run on a different thread"; 128 << m_location.file_name() << " was run on a different thread";
129 #endif 129 #endif
130 TRACE_EVENT_SET_SAMPLING_STATE("blink", "BlinkInternal");
131 130
132 if (m_repeatInterval) { 131 if (m_repeatInterval) {
133 double now = timerMonotonicallyIncreasingTime(); 132 double now = timerMonotonicallyIncreasingTime();
134 // This computation should be drift free, and it will cope if we miss a 133 // This computation should be drift free, and it will cope if we miss a
135 // beat, which can easily happen if the thread is busy. It will also cope 134 // beat, which can easily happen if the thread is busy. It will also cope
136 // if we get called slightly before m_unalignedNextFireTime, which can 135 // if we get called slightly before m_unalignedNextFireTime, which can
137 // happen due to lack of timer precision. 136 // happen due to lack of timer precision.
138 double intervalToNextFireTime = 137 double intervalToNextFireTime =
139 m_repeatInterval - fmod(now - m_nextFireTime, m_repeatInterval); 138 m_repeatInterval - fmod(now - m_nextFireTime, m_repeatInterval);
140 setNextFireTime(timerMonotonicallyIncreasingTime(), intervalToNextFireTime); 139 setNextFireTime(timerMonotonicallyIncreasingTime(), intervalToNextFireTime);
141 } else { 140 } else {
142 m_nextFireTime = 0; 141 m_nextFireTime = 0;
143 } 142 }
144 fired(); 143 fired();
145 TRACE_EVENT_SET_SAMPLING_STATE("blink", "Sleeping");
146 } 144 }
147 145
148 bool TimerBase::Comparator::operator()(const TimerBase* a, 146 bool TimerBase::Comparator::operator()(const TimerBase* a,
149 const TimerBase* b) const { 147 const TimerBase* b) const {
150 return a->m_nextFireTime < b->m_nextFireTime; 148 return a->m_nextFireTime < b->m_nextFireTime;
151 } 149 }
152 150
153 // static 151 // static
154 double TimerBase::timerMonotonicallyIncreasingTime() const { 152 double TimerBase::timerMonotonicallyIncreasingTime() const {
155 return timerTaskRunner()->monotonicallyIncreasingVirtualTimeSeconds(); 153 return timerTaskRunner()->monotonicallyIncreasingVirtualTimeSeconds();
156 } 154 }
157 155
158 } // namespace blink 156 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/platform/heap/Heap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698