| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef IdleDeadline_h | 5 #ifndef IdleDeadline_h |
| 6 #define IdleDeadline_h | 6 #define IdleDeadline_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class IdleDeadline : public GarbageCollected<IdleDeadline>, | 13 class CORE_EXPORT IdleDeadline : public GarbageCollected<IdleDeadline>, |
| 14 public ScriptWrappable { | 14 public ScriptWrappable { |
| 15 DEFINE_WRAPPERTYPEINFO(); | 15 DEFINE_WRAPPERTYPEINFO(); |
| 16 | 16 |
| 17 public: | 17 public: |
| 18 enum class CallbackType { CalledWhenIdle, CalledByTimeout }; | 18 enum class CallbackType { CalledWhenIdle, CalledByTimeout }; |
| 19 | 19 |
| 20 static IdleDeadline* create(double deadlineSeconds, | 20 static IdleDeadline* create(double deadlineSeconds, |
| 21 CallbackType callbackType) { | 21 CallbackType callbackType) { |
| 22 return new IdleDeadline(deadlineSeconds, callbackType); | 22 return new IdleDeadline(deadlineSeconds, callbackType); |
| 23 } | 23 } |
| 24 | 24 |
| 25 DEFINE_INLINE_TRACE() {} | 25 DEFINE_INLINE_TRACE() {} |
| 26 | 26 |
| 27 double timeRemaining() const; | 27 double timeRemaining() const; |
| 28 | 28 |
| 29 bool didTimeout() const { | 29 bool didTimeout() const { |
| 30 return m_callbackType == CallbackType::CalledByTimeout; | 30 return m_callbackType == CallbackType::CalledByTimeout; |
| 31 } | 31 } |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 IdleDeadline(double deadlineSeconds, CallbackType); | 34 IdleDeadline(double deadlineSeconds, CallbackType); |
| 35 | 35 |
| 36 double m_deadlineSeconds; | 36 double m_deadlineSeconds; |
| 37 CallbackType m_callbackType; | 37 CallbackType m_callbackType; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 } // namespace blink | 40 } // namespace blink |
| 41 | 41 |
| 42 #endif // IdleDeadline_h | 42 #endif // IdleDeadline_h |
| OLD | NEW |