 Chromium Code Reviews
 Chromium Code Reviews Issue 1394103002:
  Wean CJS_Value off of v8::Isolate.  (Closed) 
  Base URL: https://pdfium.googlesource.com/pdfium.git@master
    
  
    Issue 1394103002:
  Wean CJS_Value off of v8::Isolate.  (Closed) 
  Base URL: https://pdfium.googlesource.com/pdfium.git@master| Index: fpdfsdk/src/javascript/Consts.cpp | 
| diff --git a/fpdfsdk/src/javascript/Consts.cpp b/fpdfsdk/src/javascript/Consts.cpp | 
| index 3381978caf0372d80ed0ff971ecd7ee7af6f9979..d71c71129d02bee48c5db55f813711f021a34785 100644 | 
| --- a/fpdfsdk/src/javascript/Consts.cpp | 
| +++ b/fpdfsdk/src/javascript/Consts.cpp | 
| @@ -129,62 +129,62 @@ IMPLEMENT_JS_CLASS_CONST(CJS_Zoomtype, zoomtype) | 
| /* ------------------------------ CJS_GlobalConsts ------------------------- */ | 
| -static void DefineGlobalConstString(v8::Isolate* pIsolate, | 
| +static void DefineGlobalConstString(CJS_Runtime* pRuntime, | 
| const wchar_t* pConstName, | 
| const wchar_t* pValue) { | 
| - FXJS_DefineGlobalConst(pIsolate, pConstName, | 
| - FXJS_NewString(pIsolate, pValue)); | 
| + FXJS_DefineGlobalConst(pRuntime->GetIsolate(), pConstName, | 
| 
Tom Sepez
2015/10/07 23:06:23
i.e. down the road, when FXJS provides an object,
 | 
| + FXJS_NewString(pRuntime->GetIsolate(), pValue)); | 
| } | 
| -void CJS_GlobalConsts::DefineJSObjects(v8::Isolate* pIsolate) { | 
| +void CJS_GlobalConsts::DefineJSObjects(CJS_Runtime* pRuntime) { | 
| DefineGlobalConstString( | 
| - pIsolate, L"IDS_GREATER_THAN", | 
| + pRuntime, L"IDS_GREATER_THAN", | 
| L"Invalid value: must be greater than or equal to % s."); | 
| DefineGlobalConstString( | 
| - pIsolate, L"IDS_GT_AND_LT", | 
| + pRuntime, L"IDS_GT_AND_LT", | 
| L"Invalid value: must be greater than or equal to % s " | 
| L"and less than or equal to % s."); | 
| - DefineGlobalConstString(pIsolate, L"IDS_LESS_THAN", | 
| + DefineGlobalConstString(pRuntime, L"IDS_LESS_THAN", | 
| L"Invalid value: must be less than or equal to % s."); | 
| - DefineGlobalConstString(pIsolate, L"IDS_INVALID_MONTH", L"**Invalid**"); | 
| + DefineGlobalConstString(pRuntime, L"IDS_INVALID_MONTH", L"**Invalid**"); | 
| DefineGlobalConstString( | 
| - pIsolate, L"IDS_INVALID_DATE", | 
| + pRuntime, L"IDS_INVALID_DATE", | 
| L"Invalid date / time: please ensure that the date / time exists.Field"); | 
| DefineGlobalConstString( | 
| - pIsolate, L"IDS_INVALID_VALUE", | 
| + pRuntime, L"IDS_INVALID_VALUE", | 
| L"The value entered does not match the format of the field"); | 
| - DefineGlobalConstString(pIsolate, L"IDS_AM", L"am"); | 
| - DefineGlobalConstString(pIsolate, L"IDS_PM", L"pm"); | 
| + DefineGlobalConstString(pRuntime, L"IDS_AM", L"am"); | 
| + DefineGlobalConstString(pRuntime, L"IDS_PM", L"pm"); | 
| DefineGlobalConstString( | 
| - pIsolate, L"IDS_MONTH_INFO", | 
| + pRuntime, L"IDS_MONTH_INFO", | 
| L"January[1] February[2] March[3] April[4] May[5] " | 
| L"June[6] July[7] August[8] September[9] October[10] " | 
| L"November[11] December[12] Sept[9] Jan[1] Feb[2] Mar[3] " | 
| L"Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] Nov[11] " | 
| L"Dec[12]"); | 
| - DefineGlobalConstString(pIsolate, L"IDS_STARTUP_CONSOLE_MSG", L"** ^ _ ^ **"); | 
| + DefineGlobalConstString(pRuntime, L"IDS_STARTUP_CONSOLE_MSG", L"** ^ _ ^ **"); | 
| } | 
| /* ------------------------------ CJS_GlobalArrays ------------------------ */ | 
| -void DefineGlobalConstStringArray(v8::Isolate* pIsolate, | 
| +void DefineGlobalConstStringArray(CJS_Runtime* pRuntime, | 
| const wchar_t* sConstName, | 
| const wchar_t** pValues, | 
| size_t nValues) { | 
| - CJS_Array array(pIsolate); | 
| + CJS_Array array(pRuntime); | 
| for (size_t i = 0; i < nValues; ++i) { | 
| - array.SetElement(i, CJS_Value(pIsolate, pValues[i])); | 
| + array.SetElement(i, CJS_Value(pRuntime, pValues[i])); | 
| } | 
| - CJS_PropValue prop(pIsolate); | 
| + CJS_PropValue prop(pRuntime); | 
| prop << array; | 
| - FXJS_DefineGlobalConst(pIsolate, sConstName, prop.ToV8Value()); | 
| + FXJS_DefineGlobalConst(pRuntime->GetIsolate(), sConstName, prop.ToV8Value()); | 
| } | 
| -void CJS_GlobalArrays::DefineJSObjects(v8::Isolate* pIsolate) { | 
| +void CJS_GlobalArrays::DefineJSObjects(CJS_Runtime* pRuntime) { | 
| { | 
| const FX_WCHAR* ArrayName = L"RE_NUMBER_ENTRY_DOT_SEP"; | 
| const FX_WCHAR* ArrayContent[] = {L"[+-]?\\d*\\.?\\d*"}; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| @@ -195,7 +195,7 @@ void CJS_GlobalArrays::DefineJSObjects(v8::Isolate* pIsolate) { | 
| L"[+-]?\\.\\d+", /* -.1 */ | 
| L"[+-]?\\d+\\." /* -1. */ | 
| }; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| @@ -203,7 +203,7 @@ void CJS_GlobalArrays::DefineJSObjects(v8::Isolate* pIsolate) { | 
| const FX_WCHAR* ArrayName = L"RE_NUMBER_ENTRY_COMMA_SEP"; | 
| const FX_WCHAR* ArrayContent[] = {L"[+-]?\\d*,?\\d*"}; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| @@ -214,35 +214,35 @@ void CJS_GlobalArrays::DefineJSObjects(v8::Isolate* pIsolate) { | 
| L"[+-]?[.,]\\d+", /* -,1 */ | 
| L"[+-]?\\d+[.,]" /* -1, */ | 
| }; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| { | 
| const FX_WCHAR* ArrayName = L"RE_ZIP_ENTRY"; | 
| const FX_WCHAR* ArrayContent[] = {L"\\d{0,5}"}; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| { | 
| const FX_WCHAR* ArrayName = L"RE_ZIP_COMMIT"; | 
| const FX_WCHAR* ArrayContent[] = {L"\\d{5}"}; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| { | 
| const FX_WCHAR* ArrayName = L"RE_ZIP4_ENTRY"; | 
| const FX_WCHAR* ArrayContent[] = {L"\\d{0,5}(\\.|[- ])?\\d{0,4}"}; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| { | 
| const FX_WCHAR* ArrayName = L"RE_ZIP4_COMMIT"; | 
| const FX_WCHAR* ArrayContent[] = {L"\\d{5}(\\.|[- ])?\\d{4}"}; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| @@ -261,7 +261,7 @@ void CJS_GlobalArrays::DefineJSObjects(v8::Isolate* pIsolate) { | 
| */ | 
| L"011(\\.|[- \\d])*" /* international */ | 
| }; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| @@ -273,7 +273,7 @@ void CJS_GlobalArrays::DefineJSObjects(v8::Isolate* pIsolate) { | 
| L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", /* (408) 555-1234 */ | 
| L"011(\\.|[- \\d])*" /* international */ | 
| }; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| @@ -281,7 +281,7 @@ void CJS_GlobalArrays::DefineJSObjects(v8::Isolate* pIsolate) { | 
| const FX_WCHAR* ArrayName = L"RE_SSN_ENTRY"; | 
| const FX_WCHAR* ArrayContent[] = { | 
| L"\\d{0,3}(\\.|[- ])?\\d{0,2}(\\.|[- ])?\\d{0,4}"}; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| @@ -289,7 +289,7 @@ void CJS_GlobalArrays::DefineJSObjects(v8::Isolate* pIsolate) { | 
| const FX_WCHAR* ArrayName = L"RE_SSN_COMMIT"; | 
| const FX_WCHAR* ArrayContent[] = { | 
| L"\\d{3}(\\.|[- ])?\\d{2}(\\.|[- ])?\\d{4}"}; | 
| - DefineGlobalConstStringArray(pIsolate, ArrayName, ArrayContent, | 
| + DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent, | 
| FX_ArraySize(ArrayContent)); | 
| } | 
| } |