Dan Sinclair | c085835 | 2017-10-30 17:49:52 +0000 | [diff] [blame] | 1 | // Copyright 2017 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Dan Sinclair | e0345a4 | 2017-10-30 20:20:42 +0000 | [diff] [blame] | 7 | #ifndef FXJS_CJS_TIMEROBJ_H_ |
| 8 | #define FXJS_CJS_TIMEROBJ_H_ |
Dan Sinclair | c085835 | 2017-10-30 17:49:52 +0000 | [diff] [blame] | 9 | |
Tom Sepez | 221f0b3 | 2018-06-04 22:11:27 +0000 | [diff] [blame] | 10 | #include "fxjs/js_define.h" |
Dan Sinclair | c085835 | 2017-10-30 17:49:52 +0000 | [diff] [blame] | 11 | |
| 12 | class GlobalTimer; |
| 13 | |
Tom Sepez | 5586545 | 2018-08-27 20:18:04 +0000 | [diff] [blame^] | 14 | class CJS_TimerObj final : public CJS_Object { |
Dan Sinclair | c085835 | 2017-10-30 17:49:52 +0000 | [diff] [blame] | 15 | public: |
| 16 | static int GetObjDefnID(); |
| 17 | static void DefineJSObjects(CFXJS_Engine* pEngine); |
| 18 | |
Tom Sepez | 36aae4f | 2018-06-04 19:44:37 +0000 | [diff] [blame] | 19 | CJS_TimerObj(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime); |
Dan Sinclair | f743552 | 2018-02-05 22:27:22 +0000 | [diff] [blame] | 20 | ~CJS_TimerObj() override; |
| 21 | |
| 22 | void SetTimer(GlobalTimer* pTimer); |
| 23 | int GetTimerID() const { return m_nTimerID; } |
Dan Sinclair | c085835 | 2017-10-30 17:49:52 +0000 | [diff] [blame] | 24 | |
| 25 | private: |
| 26 | static int ObjDefnID; |
Dan Sinclair | f743552 | 2018-02-05 22:27:22 +0000 | [diff] [blame] | 27 | |
Tom Sepez | 36aae4f | 2018-06-04 19:44:37 +0000 | [diff] [blame] | 28 | int m_nTimerID = 0; // Weak reference to GlobalTimer through global map. |
Dan Sinclair | c085835 | 2017-10-30 17:49:52 +0000 | [diff] [blame] | 29 | }; |
| 30 | |
Dan Sinclair | e0345a4 | 2017-10-30 20:20:42 +0000 | [diff] [blame] | 31 | #endif // FXJS_CJS_TIMEROBJ_H_ |