xref: /aosp_15_r20/external/pdfium/fxjs/cjs_timerobj.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1*3ac0a46fSAndroid Build Coastguard Worker // Copyright 2017 The PDFium Authors
2*3ac0a46fSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*3ac0a46fSAndroid Build Coastguard Worker // found in the LICENSE file.
4*3ac0a46fSAndroid Build Coastguard Worker 
5*3ac0a46fSAndroid Build Coastguard Worker // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6*3ac0a46fSAndroid Build Coastguard Worker 
7*3ac0a46fSAndroid Build Coastguard Worker #include "fxjs/cjs_timerobj.h"
8*3ac0a46fSAndroid Build Coastguard Worker 
9*3ac0a46fSAndroid Build Coastguard Worker #include "fxjs/global_timer.h"
10*3ac0a46fSAndroid Build Coastguard Worker #include "fxjs/js_define.h"
11*3ac0a46fSAndroid Build Coastguard Worker 
12*3ac0a46fSAndroid Build Coastguard Worker uint32_t CJS_TimerObj::ObjDefnID = 0;
13*3ac0a46fSAndroid Build Coastguard Worker 
14*3ac0a46fSAndroid Build Coastguard Worker // static
GetObjDefnID()15*3ac0a46fSAndroid Build Coastguard Worker uint32_t CJS_TimerObj::GetObjDefnID() {
16*3ac0a46fSAndroid Build Coastguard Worker   return ObjDefnID;
17*3ac0a46fSAndroid Build Coastguard Worker }
18*3ac0a46fSAndroid Build Coastguard Worker 
19*3ac0a46fSAndroid Build Coastguard Worker // static
DefineJSObjects(CFXJS_Engine * pEngine)20*3ac0a46fSAndroid Build Coastguard Worker void CJS_TimerObj::DefineJSObjects(CFXJS_Engine* pEngine) {
21*3ac0a46fSAndroid Build Coastguard Worker   ObjDefnID = pEngine->DefineObj("TimerObj", FXJSOBJTYPE_DYNAMIC,
22*3ac0a46fSAndroid Build Coastguard Worker                                  JSConstructor<CJS_TimerObj>, JSDestructor);
23*3ac0a46fSAndroid Build Coastguard Worker }
24*3ac0a46fSAndroid Build Coastguard Worker 
CJS_TimerObj(v8::Local<v8::Object> pObject,CJS_Runtime * pRuntime)25*3ac0a46fSAndroid Build Coastguard Worker CJS_TimerObj::CJS_TimerObj(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime)
26*3ac0a46fSAndroid Build Coastguard Worker     : CJS_Object(pObject, pRuntime) {}
27*3ac0a46fSAndroid Build Coastguard Worker 
28*3ac0a46fSAndroid Build Coastguard Worker CJS_TimerObj::~CJS_TimerObj() = default;
29*3ac0a46fSAndroid Build Coastguard Worker 
SetTimer(GlobalTimer * pTimer)30*3ac0a46fSAndroid Build Coastguard Worker void CJS_TimerObj::SetTimer(GlobalTimer* pTimer) {
31*3ac0a46fSAndroid Build Coastguard Worker   m_nTimerID = pTimer->GetTimerID();
32*3ac0a46fSAndroid Build Coastguard Worker }
33