Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Side by Side Diff: fpdfsdk/javascript/Consts.cpp

Issue 2241483004: Move some v8 objects from CJS back into FXJS (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rename to GetCurrentEngineFromIsolate() since engines not 1:1 with isolates Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | fpdfsdk/javascript/JS_Define.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/javascript/Consts.h" 7 #include "fpdfsdk/javascript/Consts.h"
8 8
9 #include "fpdfsdk/javascript/JS_Define.h" 9 #include "fpdfsdk/javascript/JS_Define.h"
10 #include "fpdfsdk/javascript/JS_Object.h" 10 #include "fpdfsdk/javascript/JS_Object.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 { \ 141 { \
142 const FX_WCHAR* values[] = {__VA_ARGS__}; \ 142 const FX_WCHAR* values[] = {__VA_ARGS__}; \
143 v8::Local<v8::Array> array = FXJS_NewArray((rt)->GetIsolate()); \ 143 v8::Local<v8::Array> array = FXJS_NewArray((rt)->GetIsolate()); \
144 for (size_t i = 0; i < FX_ArraySize(values); ++i) \ 144 for (size_t i = 0; i < FX_ArraySize(values); ++i) \
145 array->Set(i, FXJS_NewString((rt)->GetIsolate(), values[i])); \ 145 array->Set(i, FXJS_NewString((rt)->GetIsolate(), values[i])); \
146 rt->SetConstArray(name, array); \ 146 rt->SetConstArray(name, array); \
147 FXJS_DefineGlobalConst( \ 147 FXJS_DefineGlobalConst( \
148 (rt)->GetIsolate(), (name), \ 148 (rt)->GetIsolate(), (name), \
149 [](const v8::FunctionCallbackInfo<v8::Value>& info) { \ 149 [](const v8::FunctionCallbackInfo<v8::Value>& info) { \
150 CJS_Runtime* pLocalRuntime = static_cast<CJS_Runtime*>( \ 150 CJS_Runtime* pLocalRuntime = static_cast<CJS_Runtime*>( \
151 FXJS_GetRuntimeFromIsolate(info.GetIsolate())); \ 151 FXJS_GetCurrentEngineFromIsolate(info.GetIsolate())); \
152 if (pLocalRuntime) \ 152 if (pLocalRuntime) \
153 info.GetReturnValue().Set(pLocalRuntime->GetConstArray(name)); \ 153 info.GetReturnValue().Set(pLocalRuntime->GetConstArray(name)); \
154 }); \ 154 }); \
155 } 155 }
156 156
157 void CJS_GlobalArrays::DefineJSObjects(CJS_Runtime* pRuntime) { 157 void CJS_GlobalArrays::DefineJSObjects(CJS_Runtime* pRuntime) {
158 GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_ENTRY_DOT_SEP", L"[+-]?\\d*\\.?\\d*"); 158 GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_ENTRY_DOT_SEP", L"[+-]?\\d*\\.?\\d*");
159 GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_COMMIT_DOT_SEP", 159 GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_COMMIT_DOT_SEP",
160 L"[+-]?\\d+(\\.\\d+)?", // -1.0 or -1 160 L"[+-]?\\d+(\\.\\d+)?", // -1.0 or -1
161 L"[+-]?\\.\\d+", // -.1 161 L"[+-]?\\.\\d+", // -.1
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 L"\\d{3}(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // 408 555-1234 196 L"\\d{3}(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // 408 555-1234
197 L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // (408) 555-1234 197 L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // (408) 555-1234
198 L"011(\\.|[- \\d])*"); // international 198 L"011(\\.|[- \\d])*"); // international
199 199
200 GLOBAL_ARRAY(pRuntime, L"RE_SSN_ENTRY", 200 GLOBAL_ARRAY(pRuntime, L"RE_SSN_ENTRY",
201 L"\\d{0,3}(\\.|[- ])?\\d{0,2}(\\.|[- ])?\\d{0,4}"); 201 L"\\d{0,3}(\\.|[- ])?\\d{0,2}(\\.|[- ])?\\d{0,4}");
202 202
203 GLOBAL_ARRAY(pRuntime, L"RE_SSN_COMMIT", 203 GLOBAL_ARRAY(pRuntime, L"RE_SSN_COMMIT",
204 L"\\d{3}(\\.|[- ])?\\d{2}(\\.|[- ])?\\d{4}"); 204 L"\\d{3}(\\.|[- ])?\\d{2}(\\.|[- ])?\\d{4}");
205 } 205 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/javascript/JS_Define.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698