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

Side by Side Diff: fpdfsdk/include/javascript/JS_Define.h

Issue 933043002: Kill off unused IFXJS interface methods. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: More unused code Created 5 years, 10 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 | « fpdfsdk/include/javascript/IJavaScript.h ('k') | fpdfsdk/include/javascript/JS_Runtime.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 #ifndef _JS_DEFINE_H_ 7 #ifndef _JS_DEFINE_H_
8 #define _JS_DEFINE_H_ 8 #define _JS_DEFINE_H_
9 9
10 typedef v8::Value JSValue; 10 typedef v8::Value JSValue;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return ;\ 196 return ;\
197 }\ 197 }\
198 } 198 }
199 199
200 /* ===================================== JS CLASS ============================== ================= */ 200 /* ===================================== JS CLASS ============================== ================= */
201 201
202 #define DECLARE_JS_CLASS(js_class_name) \ 202 #define DECLARE_JS_CLASS(js_class_name) \
203 static JSBool JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global);\ 203 static JSBool JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global);\
204 static JSBool JSDestructor(JSFXObject obj);\ 204 static JSBool JSDestructor(JSFXObject obj);\
205 static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\ 205 static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
206 static void GetConsts(JSConstSpec*& pConsts, int& nSize);\
207 static void GetProperties(JSPropertySpec*& pProperties, int& nSize);\
208 static void GetMethods(JSMethodSpec*& pMethods, int& nSize);\
209 static JSConstSpec JS_Class_Consts[];\ 206 static JSConstSpec JS_Class_Consts[];\
210 static JSPropertySpec JS_Class_Properties[];\ 207 static JSPropertySpec JS_Class_Properties[];\
211 static JSMethodSpec JS_Class_Methods[];\ 208 static JSMethodSpec JS_Class_Methods[];\
212 static const wchar_t* m_pClassName 209 static const wchar_t* m_pClassName
213 210
214 #define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \ 211 #define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \
215 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\ 212 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
216 JSBool js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObjec t global)\ 213 JSBool js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObjec t global)\
217 {\ 214 {\
218 CJS_Object* pObj = FX_NEW js_class_name(obj);\ 215 CJS_Object* pObj = FX_NEW js_class_name(obj);\
(...skipping 22 matching lines...) Expand all
241 if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_ Properties[j].pName, JS_Class_Properties[j].pPropGet, JS_Class_Properties[j].pPr opPut) < 0) return -1;\ 238 if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_ Properties[j].pName, JS_Class_Properties[j].pPropGet, JS_Class_Properties[j].pPr opPut) < 0) return -1;\
242 }\ 239 }\
243 for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)- 1; k<szk; k++)\ 240 for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)- 1; k<szk; k++)\
244 {\ 241 {\
245 if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Met hods[k].pName, JS_Class_Methods[k].pMethodCall, JS_Class_Methods[k].nParamNum) < 0) return -1;\ 242 if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Met hods[k].pName, JS_Class_Methods[k].pMethodCall, JS_Class_Methods[k].nParamNum) < 0) return -1;\
246 }\ 243 }\
247 return nObjDefnID;\ 244 return nObjDefnID;\
248 }\ 245 }\
249 return -1;\ 246 return -1;\
250 }\ 247 }\
251 void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\
252 {\
253 pConsts = JS_Class_Consts;\
254 nSize = sizeof(JS_Class_Consts) / sizeof(JSConstSpec) - 1;\
255 }\
256 void js_class_name::GetProperties(JSPropertySpec*& pProperties, int& nSize)\
257 {\
258 pProperties = JS_Class_Properties;\
259 nSize = sizeof(JS_Class_Properties) / sizeof(JSPropertySpec) - 1;\
260 }\
261 void js_class_name::GetMethods(JSMethodSpec*& pMethods, int& nSize)\
262 {\
263 pMethods = JS_Class_Methods;\
264 nSize = sizeof(JS_Class_Methods) / sizeof(JSMethodSpec) - 1;\
265 }
266 248
267 #define IMPLEMENT_JS_CLASS(js_class_name, class_name) IMPLEMENT_JS_CLASS_RICH(js _class_name, class_name, class_name) 249 #define IMPLEMENT_JS_CLASS(js_class_name, class_name) IMPLEMENT_JS_CLASS_RICH(js _class_name, class_name, class_name)
268 250
269 /* ======================================== CONST CLASS ======================== ==================== */ 251 /* ======================================== CONST CLASS ======================== ==================== */
270 252
271 #define DECLARE_JS_CLASS_CONST() \ 253 #define DECLARE_JS_CLASS_CONST() \
272 static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\ 254 static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
273 static void GetConsts(JSConstSpec*& pConsts, int& nSize);\
274 static JSConstSpec JS_Class_Consts[];\ 255 static JSConstSpec JS_Class_Consts[];\
275 static const wchar_t* m_pClassName 256 static const wchar_t* m_pClassName
276 257
277 #define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \ 258 #define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \
278 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\ 259 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
279 int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\ 260 int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
280 {\ 261 {\
281 int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eOb jType, NULL, NULL, 0);\ 262 int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eOb jType, NULL, NULL, 0);\
282 if (nObjDefnID >=0)\ 263 if (nObjDefnID >=0)\
283 {\ 264 {\
284 for (int i=0, sz=sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1; i<sz; i++)\ 265 for (int i=0, sz=sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1; i<sz; i++)\
285 {\ 266 {\
286 if (JS_Class_Consts[i].t == 0)\ 267 if (JS_Class_Consts[i].t == 0)\
287 {\ 268 {\
288 if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_C lass_Consts[i].pName, JS_NewNumber(pRuntime,JS_Class_Consts[i].number)) < 0) ret urn -1;\ 269 if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_C lass_Consts[i].pName, JS_NewNumber(pRuntime,JS_Class_Consts[i].number)) < 0) ret urn -1;\
289 }\ 270 }\
290 else\ 271 else\
291 {\ 272 {\
292 if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Con sts[i].pName, JS_NewString(pRuntime,JS_Class_Consts[i].string)) < 0) return -1;\ 273 if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Con sts[i].pName, JS_NewString(pRuntime,JS_Class_Consts[i].string)) < 0) return -1;\
293 }\ 274 }\
294 }\ 275 }\
295 return nObjDefnID;\ 276 return nObjDefnID;\
296 }\ 277 }\
297 return -1;\ 278 return -1;\
298 }\
299 void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\
300 {\
301 pConsts = JS_Class_Consts;\
302 nSize = sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1;\
303 } 279 }
304 280
305 /* ===================================== SPECIAL JS CLASS ====================== ========================= */ 281 /* ===================================== SPECIAL JS CLASS ====================== ========================= */
306 282
307 #define DECLARE_SPECIAL_JS_CLASS(js_class_name) \ 283 #define DECLARE_SPECIAL_JS_CLASS(js_class_name) \
308 static JSBool JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObjec t global);\ 284 static JSBool JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObjec t global);\
309 static JSBool JSDestructor(JSFXObject obj);\ 285 static JSBool JSDestructor(JSFXObject obj);\
310 static void GetConsts(JSConstSpec*& pConsts, int& nSize);\
311 static void GetProperties(JSPropertySpec*& pProperties, int& nSize);\
312 static void GetMethods(JSMethodSpec*& pMethods, int& nSize);\
313 static JSConstSpec JS_Class_Consts[];\ 286 static JSConstSpec JS_Class_Consts[];\
314 static JSPropertySpec JS_Class_Properties[];\ 287 static JSPropertySpec JS_Class_Properties[];\
315 static JSMethodSpec JS_Class_Methods[];\ 288 static JSMethodSpec JS_Class_Methods[];\
316 static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\ 289 static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
317 static const wchar_t* m_pClassName;\ 290 static const wchar_t* m_pClassName;\
318 static void queryprop_##js_class_name##_static(JS_PROPQUERY_ARGS);\ 291 static void queryprop_##js_class_name##_static(JS_PROPQUERY_ARGS);\
319 static void getprop_##js_class_name##_static(JS_NAMED_PROPGET_ARGS);\ 292 static void getprop_##js_class_name##_static(JS_NAMED_PROPGET_ARGS);\
320 static void putprop_##js_class_name##_static(JS_NAMED_PROPPUT_ARGS);\ 293 static void putprop_##js_class_name##_static(JS_NAMED_PROPPUT_ARGS);\
321 static void delprop_##js_class_name##_static(JS_PROPDEL_ARGS) 294 static void delprop_##js_class_name##_static(JS_PROPDEL_ARGS)
322 295
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)- 1; k<szk; k++)\ 452 for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)- 1; k<szk; k++)\
480 {\ 453 {\
481 if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Met hods[k].pName,JS_Class_Methods[k].pMethodCall,JS_Class_Methods[k].nParamNum)<0)r eturn -1;\ 454 if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Met hods[k].pName,JS_Class_Methods[k].pMethodCall,JS_Class_Methods[k].nParamNum)<0)r eturn -1;\
482 }\ 455 }\
483 if (JS_DefineObjAllProperties(pRuntime, nObjDefnID, js_class_nam e::queryprop_##js_class_name##_static, js_class_name::getprop_##js_class_name##_ static,js_class_name::putprop_##js_class_name##_static,js_class_name::delprop_## js_class_name##_static)<0) return -1;\ 456 if (JS_DefineObjAllProperties(pRuntime, nObjDefnID, js_class_nam e::queryprop_##js_class_name##_static, js_class_name::getprop_##js_class_name##_ static,js_class_name::putprop_##js_class_name##_static,js_class_name::delprop_## js_class_name##_static)<0) return -1;\
484 \ 457 \
485 return nObjDefnID;\ 458 return nObjDefnID;\
486 }\ 459 }\
487 \ 460 \
488 return -1;\ 461 return -1;\
489 }\
490 void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\
491 {\
492 pConsts = JS_Class_Consts;\
493 nSize = sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1;\
494 }\
495 void js_class_name::GetProperties(JSPropertySpec*& pProperties, int& nSize)\
496 {\
497 pProperties = JS_Class_Properties;\
498 nSize = sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1;\
499 }\
500 void js_class_name::GetMethods(JSMethodSpec*& pMethods, int& nSize)\
501 {\
502 pMethods = JS_Class_Methods;\
503 nSize = sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1;\
504 } 462 }
505 463
506 #define JS_SPECIAL_STATIC_METHOD(method_name, class_alternate, class_name)\ 464 #define JS_SPECIAL_STATIC_METHOD(method_name, class_alternate, class_name)\
507 static void method_name##_static(const v8::FunctionCallbackInfo<v8::Valu e>& info)\ 465 static void method_name##_static(const v8::FunctionCallbackInfo<v8::Valu e>& info)\
508 {\ 466 {\
509 v8::Isolate* isolate = info.GetIsolate();\ 467 v8::Isolate* isolate = info.GetIsolate();\
510 v8::Local<v8::Context> context = isolate->GetCurrentContext();\ 468 v8::Local<v8::Context> context = isolate->GetCurrentContext();\
511 IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);\ 469 IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);\
512 if (pRuntime == NULL) return;\ 470 if (pRuntime == NULL) return;\
513 IFXJS_Context* cc = pRuntime->GetCurrentContext();\ 471 IFXJS_Context* cc = pRuntime->GetCurrentContext();\
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 #define VALUE_NAME_NULL L"null" 579 #define VALUE_NAME_NULL L"null"
622 #define VALUE_NAME_UNDEFINED L"undefined" 580 #define VALUE_NAME_UNDEFINED L"undefined"
623 581
624 #define CLASSNAME_ARRAY L"Array" 582 #define CLASSNAME_ARRAY L"Array"
625 #define CLASSNAME_DATE L"Date" 583 #define CLASSNAME_DATE L"Date"
626 #define CLASSNAME_STRING L"v8::String" 584 #define CLASSNAME_STRING L"v8::String"
627 585
628 FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p); 586 FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p);
629 587
630 #endif //_JS_DEFINE_H_ 588 #endif //_JS_DEFINE_H_
OLDNEW
« no previous file with comments | « fpdfsdk/include/javascript/IJavaScript.h ('k') | fpdfsdk/include/javascript/JS_Runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698