summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/util.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-08 12:24:19 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-08 12:24:19 -0700
commit67fd5df1a378195ae3fb40c862a4e6e58731020a (patch)
tree498a4803209d78747f97ed514c45981df47de3e5 /fpdfsdk/src/javascript/util.cpp
parent6d5649b46c73bde7de2488b5631ecbf0d4a3bb05 (diff)
downloadpdfium-67fd5df1a378195ae3fb40c862a4e6e58731020a.tar.xz
Merge to XFA: Wean CJS_Value off of v8::Isolate.
(cherry picked from commit 287b63d9ab410783d71cf37291f09fd57d3059b4) Original Review URL: https://codereview.chromium.org/1394103002 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1394053003 .
Diffstat (limited to 'fpdfsdk/src/javascript/util.cpp')
-rw-r--r--fpdfsdk/src/javascript/util.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp
index 6a48c09a08..14e15c1b6f 100644
--- a/fpdfsdk/src/javascript/util.cpp
+++ b/fpdfsdk/src/javascript/util.cpp
@@ -20,16 +20,6 @@
#include <ctype.h>
#endif
-static v8::Isolate* GetIsolate(IJS_Context* cc) {
- CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
-
- CJS_Runtime* pRuntime = pContext->GetJSRuntime();
- ASSERT(pRuntime != NULL);
-
- return pRuntime->GetIsolate();
-}
-
BEGIN_JS_STATIC_CONST(CJS_Util)
END_JS_STATIC_CONST()
@@ -191,17 +181,16 @@ FX_BOOL util::printd(IJS_Context* cc,
const CJS_Parameters& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- v8::Isolate* isolate = GetIsolate(cc);
-
int iSize = params.size();
if (iSize < 2)
return FALSE;
- CJS_Value p1(isolate);
+ CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
+ CJS_Value p1(pRuntime);
p1 = params[0];
CJS_Value p2 = params[1];
- CJS_Date jsDate(isolate);
+ CJS_Date jsDate(pRuntime);
if (!p2.ConvertToDate(jsDate)) {
sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPRINT1);
return FALSE;
@@ -504,7 +493,6 @@ FX_BOOL util::scand(IJS_Context* cc,
const CJS_Parameters& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- v8::Isolate* isolate = GetIsolate(cc);
int iSize = params.size();
if (iSize < 2)
return FALSE;
@@ -518,8 +506,7 @@ FX_BOOL util::scand(IJS_Context* cc,
}
if (!JS_PortIsNan(dDate)) {
- CJS_Date date(isolate, dDate);
- vRet = date;
+ vRet = CJS_Date(CJS_Runtime::FromContext(cc), dDate);
} else {
vRet.SetNull();
}