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

Side by Side Diff: sky/engine/platform/Timer.h

Issue 681113004: Remove Heap.h (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 class Timer final : public TimerBase { 117 class Timer final : public TimerBase {
118 public: 118 public:
119 typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*); 119 typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*);
120 120
121 Timer(TimerFiredClass* o, TimerFiredFunction f) 121 Timer(TimerFiredClass* o, TimerFiredFunction f)
122 : m_object(o), m_function(f) { } 122 : m_object(o), m_function(f) { }
123 123
124 private: 124 private:
125 virtual void fired() override { (m_object->*m_function)(this); } 125 virtual void fired() override { (m_object->*m_function)(this); }
126 126
127 // FIXME: oilpan: TimerBase should be moved to the heap and m_object should be traced.
128 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha t's the case
129 // in the current code base).
130 GC_PLUGIN_IGNORE("363031")
131 TimerFiredClass* m_object; 127 TimerFiredClass* m_object;
132 TimerFiredFunction m_function; 128 TimerFiredFunction m_function;
133 }; 129 };
134 130
135 inline bool TimerBase::isActive() const 131 inline bool TimerBase::isActive() const
136 { 132 {
137 ASSERT(m_thread == currentThread()); 133 ASSERT(m_thread == currentThread());
138 return m_nextFireTime; 134 return m_nextFireTime;
139 } 135 }
140 136
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if (m_shouldRestartWhenTimerFires) { 169 if (m_shouldRestartWhenTimerFires) {
174 m_shouldRestartWhenTimerFires = false; 170 m_shouldRestartWhenTimerFires = false;
175 // FIXME: This should not be FROM_HERE. 171 // FIXME: This should not be FROM_HERE.
176 startOneShot(m_delay, FROM_HERE); 172 startOneShot(m_delay, FROM_HERE);
177 return; 173 return;
178 } 174 }
179 175
180 (m_object->*m_function)(this); 176 (m_object->*m_function)(this);
181 } 177 }
182 178
183 // FIXME: oilpan: TimerBase should be moved to the heap and m_object should be traced.
184 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha t's the case 179 // This raw pointer is safe as long as Timer<X> is held by the X itself (Tha t's the case
185 // in the current code base). 180 // in the current code base).
186 GC_PLUGIN_IGNORE("363031")
187 TimerFiredClass* m_object; 181 TimerFiredClass* m_object;
188 TimerFiredFunction m_function; 182 TimerFiredFunction m_function;
189 183
190 double m_delay; 184 double m_delay;
191 bool m_shouldRestartWhenTimerFires; 185 bool m_shouldRestartWhenTimerFires;
192 }; 186 };
193 187
194 } 188 }
195 189
196 #endif 190 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698