diff options
author | dsinclair <dsinclair@chromium.org> | 2016-05-26 09:40:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-26 09:40:27 -0700 |
commit | 7f2abcc015583e63cceb52acde757cb2111420bd (patch) | |
tree | e8dc22bf5164f0c703ff4dda86447b85002c865d /xfa/fxjse/context.cpp | |
parent | cfaffc09b1d62a81679fb01b0cc85e050be969b7 (diff) | |
download | pdfium-7f2abcc015583e63cceb52acde757cb2111420bd.tar.xz |
Replace FXJSE_HCONTEXT with CFXJSE_Context*
This Cl removes FXJSE_HCONTEXT and replaces it with the concrete CFXJSE_Context.
All varibles have been updated as well to match the new type.
Review-Url: https://codereview.chromium.org/2013963005
Diffstat (limited to 'xfa/fxjse/context.cpp')
-rw-r--r-- | xfa/fxjse/context.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/xfa/fxjse/context.cpp b/xfa/fxjse/context.cpp index b125177617..76df5616e5 100644 --- a/xfa/fxjse/context.cpp +++ b/xfa/fxjse/context.cpp @@ -11,28 +11,17 @@ #include "xfa/fxjse/util_inline.h" #include "xfa/fxjse/value.h" -namespace { - -CFXJSE_Context* CFXContextFromHContext(FXJSE_HCONTEXT hContext) { - return reinterpret_cast<CFXJSE_Context*>(hContext); -} - -} // namespace - -FXJSE_HCONTEXT FXJSE_Context_Create(v8::Isolate* pIsolate, - const FXJSE_CLASS* lpGlobalClass, - void* lpGlobalObject) { - CFXJSE_Context* pContext = - CFXJSE_Context::Create(pIsolate, lpGlobalClass, lpGlobalObject); - return reinterpret_cast<FXJSE_HCONTEXT>(pContext); +CFXJSE_Context* FXJSE_Context_Create(v8::Isolate* pIsolate, + const FXJSE_CLASS* lpGlobalClass, + void* lpGlobalObject) { + return CFXJSE_Context::Create(pIsolate, lpGlobalClass, lpGlobalObject); } -void FXJSE_Context_Release(FXJSE_HCONTEXT hContext) { - delete CFXContextFromHContext(hContext); +void FXJSE_Context_Release(CFXJSE_Context* pContext) { + delete pContext; } -FXJSE_HVALUE FXJSE_Context_GetGlobalObject(FXJSE_HCONTEXT hContext) { - CFXJSE_Context* pContext = CFXContextFromHContext(hContext); +FXJSE_HVALUE FXJSE_Context_GetGlobalObject(CFXJSE_Context* pContext) { if (!pContext) return nullptr; @@ -68,20 +57,19 @@ static const FX_CHAR* szCompatibleModeScripts[] = { " }\n" " }\n" "}(this, {String: ['substr', 'toUpperCase']}));"}; -void FXJSE_Context_EnableCompatibleMode(FXJSE_HCONTEXT hContext, +void FXJSE_Context_EnableCompatibleMode(CFXJSE_Context* pContext, uint32_t dwCompatibleFlags) { for (uint32_t i = 0; i < (uint32_t)FXJSE_COMPATIBLEMODEFLAGCOUNT; i++) { if (dwCompatibleFlags & (1 << i)) { - FXJSE_ExecuteScript(hContext, szCompatibleModeScripts[i], NULL, NULL); + FXJSE_ExecuteScript(pContext, szCompatibleModeScripts[i], NULL, NULL); } } } -FX_BOOL FXJSE_ExecuteScript(FXJSE_HCONTEXT hContext, +FX_BOOL FXJSE_ExecuteScript(CFXJSE_Context* pContext, const FX_CHAR* szScript, FXJSE_HVALUE hRetValue, FXJSE_HVALUE hNewThisObject) { - CFXJSE_Context* pContext = CFXContextFromHContext(hContext); return pContext->ExecuteScript( szScript, reinterpret_cast<CFXJSE_Value*>(hRetValue), reinterpret_cast<CFXJSE_Value*>(hNewThisObject)); |