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 7 #ifndef FXJS_CJS_TIMEROBJ_H_ 8 #define FXJS_CJS_TIMEROBJ_H_ 9 10 #include "fxjs/JS_Define.h" 11 12 class GlobalTimer; 13 14 class TimerObj : public CJS_EmbedObj { 15 public: 16 explicit TimerObj(CJS_Object* pJSObject); 17 ~TimerObj() override; 18 19 void SetTimer(GlobalTimer* pTimer); GetTimerID()20 int GetTimerID() const { return m_nTimerID; } 21 22 private: 23 int m_nTimerID; // Weak reference to GlobalTimer through global map. 24 }; 25 26 class CJS_TimerObj : public CJS_Object { 27 public: 28 static int GetObjDefnID(); 29 static void DefineJSObjects(CFXJS_Engine* pEngine); 30 CJS_TimerObj(v8::Local<v8::Object> pObject)31 explicit CJS_TimerObj(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} ~CJS_TimerObj()32 ~CJS_TimerObj() override {} 33 34 private: 35 static int ObjDefnID; 36 }; 37 38 #endif // FXJS_CJS_TIMEROBJ_H_ 39