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

Side by Side Diff: fpdfsdk/src/jsapi/fxjs_v8.cpp

Issue 1171733003: Remove typdefs for pointer types in fx_system.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual fixes. Created 5 years, 6 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/src/javascript/util.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp » ('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 "../../../core/include/fxcrt/fx_basic.h" 7 #include "../../../core/include/fxcrt/fx_basic.h"
8 #include "../../../core/include/fxcrt/fx_ext.h" 8 #include "../../../core/include/fxcrt/fx_ext.h"
9 #include "../../include/jsapi/fxjs_v8.h" 9 #include "../../include/jsapi/fxjs_v8.h"
10 #include "../../include/fsdk_define.h" 10 #include "../../include/fsdk_define.h"
(...skipping 15 matching lines...) Expand all
26 { 26 {
27 return *(double*)g_nan; 27 return *(double*)g_nan;
28 } 28 }
29 29
30 30
31 class CJS_PrivateData 31 class CJS_PrivateData
32 { 32 {
33 public: 33 public:
34 CJS_PrivateData():ObjDefID(-1), pPrivate(NULL) {} 34 CJS_PrivateData():ObjDefID(-1), pPrivate(NULL) {}
35 int ObjDefID; 35 int ObjDefID;
36 » FX_LPVOID» pPrivate; 36 » void*» pPrivate;
37 }; 37 };
38 38
39 39
40 class CJS_ObjDefintion 40 class CJS_ObjDefintion
41 { 41 {
42 public: 42 public:
43 CJS_ObjDefintion(v8::Isolate* isolate, const wchar_t* sObjName, FXJSOBJT YPE eObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned b ApplyNew): 43 CJS_ObjDefintion(v8::Isolate* isolate, const wchar_t* sObjName, FXJSOBJT YPE eObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned b ApplyNew):
44 objName(sObjName), objType(eObjType), m_pConstructor(pConstructor), m_ pDestructor(pDestructor),m_bApplyNew(bApplyNew),m_bSetAsGlobalObject(FALSE) 44 objName(sObjName), objType(eObjType), m_pConstructor(pConstructor), m_ pDestructor(pDestructor),m_bApplyNew(bApplyNew),m_bSetAsGlobalObject(FALSE)
45 { 45 {
46 v8::Isolate::Scope isolate_scope(isolate); 46 v8::Isolate::Scope isolate_scope(isolate);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 CFX_WideString ws = CFX_WideString(sMethodName); 99 CFX_WideString ws = CFX_WideString(sMethodName);
100 CFX_ByteString bsMethodName = ws.UTF8Encode(); 100 CFX_ByteString bsMethodName = ws.UTF8Encode();
101 101
102 CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(0); 102 CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(0);
103 if(!pArray) return 0; 103 if(!pArray) return 0;
104 104
105 if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return 0; 105 if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return 0;
106 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID) ; 106 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID) ;
107 v8::Local<v8::ObjectTemplate> objTemp = v8::Local<v8::ObjectTemplate>::N ew(isolate, pObjDef->m_objTemplate); 107 v8::Local<v8::ObjectTemplate> objTemp = v8::Local<v8::ObjectTemplate>::N ew(isolate, pObjDef->m_objTemplate);
108 » objTemp->Set(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsMethodName), v 8::NewStringType::kNormal).ToLocalChecked(), v8::FunctionTemplate::New(isolate, pMethodCall), v8::ReadOnly); 108 » objTemp->Set(v8::String::NewFromUtf8(isolate, bsMethodName.c_str(), v8:: NewStringType::kNormal).ToLocalChecked(), v8::FunctionTemplate::New(isolate, pMe thodCall), v8::ReadOnly);
109 pObjDef->m_objTemplate.Reset(isolate,objTemp); 109 pObjDef->m_objTemplate.Reset(isolate,objTemp);
110 return 0; 110 return 0;
111 } 111 }
112 112
113 int JS_DefineObjProperty(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sPropName, v8::AccessorGetterCallback pPropGet, v8::AccessorSetterCallback pPro pPut) 113 int JS_DefineObjProperty(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sPropName, v8::AccessorGetterCallback pPropGet, v8::AccessorSetterCallback pPro pPut)
114 { 114 {
115 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; 115 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
116 v8::Isolate::Scope isolate_scope(isolate); 116 v8::Isolate::Scope isolate_scope(isolate);
117 v8::HandleScope handle_scope(isolate); 117 v8::HandleScope handle_scope(isolate);
118 118
119 CFX_WideString ws = CFX_WideString(sPropName); 119 CFX_WideString ws = CFX_WideString(sPropName);
120 CFX_ByteString bsPropertyName = ws.UTF8Encode(); 120 CFX_ByteString bsPropertyName = ws.UTF8Encode();
121 121
122 CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(0); 122 CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(0);
123 if(!pArray) return 0; 123 if(!pArray) return 0;
124 124
125 if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return 0; 125 if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return 0;
126 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID) ; 126 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID) ;
127 v8::Local<v8::ObjectTemplate> objTemp = v8::Local<v8::ObjectTemplate>::N ew(isolate, pObjDef->m_objTemplate); 127 v8::Local<v8::ObjectTemplate> objTemp = v8::Local<v8::ObjectTemplate>::N ew(isolate, pObjDef->m_objTemplate);
128 » objTemp->SetAccessor(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsProper tyName), v8::NewStringType::kNormal).ToLocalChecked(), pPropGet, pPropPut); 128 » objTemp->SetAccessor(v8::String::NewFromUtf8(isolate, bsPropertyName.c_s tr(), v8::NewStringType::kNormal).ToLocalChecked(), pPropGet, pPropPut);
129 pObjDef->m_objTemplate.Reset(isolate,objTemp); 129 pObjDef->m_objTemplate.Reset(isolate,objTemp);
130 return 0; 130 return 0;
131 } 131 }
132 132
133 int JS_DefineObjAllProperties(IJS_Runtime* pJSRuntime, int nObjDefnID, v8::N amedPropertyQueryCallback pPropQurey, v8::NamedPropertyGetterCallback pPropGet, v8::NamedPropertySetterCallback pPropPut, v8::NamedPropertyDeleterCallback pProp Del) 133 int JS_DefineObjAllProperties(IJS_Runtime* pJSRuntime, int nObjDefnID, v8::N amedPropertyQueryCallback pPropQurey, v8::NamedPropertyGetterCallback pPropGet, v8::NamedPropertySetterCallback pPropPut, v8::NamedPropertyDeleterCallback pProp Del)
134 { 134 {
135 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; 135 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
136 v8::Isolate::Scope isolate_scope(isolate); 136 v8::Isolate::Scope isolate_scope(isolate);
137 v8::HandleScope handle_scope(isolate); 137 v8::HandleScope handle_scope(isolate);
138 138
(...skipping 16 matching lines...) Expand all
155 155
156 CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(0); 156 CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(0);
157 if(!pArray) return 0; 157 if(!pArray) return 0;
158 158
159 CFX_WideString ws = CFX_WideString(sConstName); 159 CFX_WideString ws = CFX_WideString(sConstName);
160 CFX_ByteString bsConstName = ws.UTF8Encode(); 160 CFX_ByteString bsConstName = ws.UTF8Encode();
161 161
162 if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return 0; 162 if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return 0;
163 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID) ; 163 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID) ;
164 v8::Local<v8::ObjectTemplate> objTemp = v8::Local<v8::ObjectTemplate>::N ew(isolate, pObjDef->m_objTemplate); 164 v8::Local<v8::ObjectTemplate> objTemp = v8::Local<v8::ObjectTemplate>::N ew(isolate, pObjDef->m_objTemplate);
165 » objTemp->Set(isolate, FX_LPCSTR(bsConstName), pDefault); 165 » objTemp->Set(isolate, bsConstName.c_str(), pDefault);
166 pObjDef->m_objTemplate.Reset(isolate,objTemp); 166 pObjDef->m_objTemplate.Reset(isolate,objTemp);
167 return 0; 167 return 0;
168 } 168 }
169 169
170 static v8::Global<v8::ObjectTemplate>& _getGlobalObjectTemplate(IJS_Runtime* pJS Runtime) 170 static v8::Global<v8::ObjectTemplate>& _getGlobalObjectTemplate(IJS_Runtime* pJS Runtime)
171 { 171 {
172 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; 172 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
173 v8::Isolate::Scope isolate_scope(isolate); 173 v8::Isolate::Scope isolate_scope(isolate);
174 v8::HandleScope handle_scope(isolate); 174 v8::HandleScope handle_scope(isolate);
175 175
(...skipping 19 matching lines...) Expand all
195 CFX_ByteString bsMethodName = ws.UTF8Encode(); 195 CFX_ByteString bsMethodName = ws.UTF8Encode();
196 196
197 v8::Local<v8::FunctionTemplate> funTempl = v8::FunctionTemplate::New(iso late, pMethodCall); 197 v8::Local<v8::FunctionTemplate> funTempl = v8::FunctionTemplate::New(iso late, pMethodCall);
198 v8::Local<v8::ObjectTemplate> objTemp; 198 v8::Local<v8::ObjectTemplate> objTemp;
199 199
200 v8::Global<v8::ObjectTemplate>& globalObjTemp = _getGlobalObjectTemplate (pJSRuntime); 200 v8::Global<v8::ObjectTemplate>& globalObjTemp = _getGlobalObjectTemplate (pJSRuntime);
201 if(globalObjTemp.IsEmpty()) 201 if(globalObjTemp.IsEmpty())
202 objTemp = v8::ObjectTemplate::New(isolate); 202 objTemp = v8::ObjectTemplate::New(isolate);
203 else 203 else
204 objTemp = v8::Local<v8::ObjectTemplate>::New(isolate, globalObjT emp); 204 objTemp = v8::Local<v8::ObjectTemplate>::New(isolate, globalObjT emp);
205 » objTemp->Set(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsMethodName), v 8::NewStringType::kNormal).ToLocalChecked(), funTempl, v8::ReadOnly); 205 » objTemp->Set(v8::String::NewFromUtf8(isolate, bsMethodName.c_str(), v8:: NewStringType::kNormal).ToLocalChecked(), funTempl, v8::ReadOnly);
206 206
207 globalObjTemp.Reset(isolate,objTemp); 207 globalObjTemp.Reset(isolate,objTemp);
208 208
209 return 0; 209 return 0;
210 } 210 }
211 211
212 int JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8: :Local<v8::Value> pDefault) 212 int JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8: :Local<v8::Value> pDefault)
213 { 213 {
214 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; 214 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
215 v8::Isolate::Scope isolate_scope(isolate); 215 v8::Isolate::Scope isolate_scope(isolate);
216 v8::HandleScope handle_scope(isolate); 216 v8::HandleScope handle_scope(isolate);
217 217
218 CFX_WideString ws = CFX_WideString(sConstName); 218 CFX_WideString ws = CFX_WideString(sConstName);
219 CFX_ByteString bsConst= ws.UTF8Encode(); 219 CFX_ByteString bsConst= ws.UTF8Encode();
220 220
221 v8::Local<v8::ObjectTemplate> objTemp; 221 v8::Local<v8::ObjectTemplate> objTemp;
222 222
223 v8::Global<v8::ObjectTemplate>& globalObjTemp = _getGlobalObjectTemplate (pJSRuntime); 223 v8::Global<v8::ObjectTemplate>& globalObjTemp = _getGlobalObjectTemplate (pJSRuntime);
224 if(globalObjTemp.IsEmpty()) 224 if(globalObjTemp.IsEmpty())
225 objTemp = v8::ObjectTemplate::New(isolate); 225 objTemp = v8::ObjectTemplate::New(isolate);
226 else 226 else
227 objTemp = v8::Local<v8::ObjectTemplate>::New(isolate, globalObjT emp); 227 objTemp = v8::Local<v8::ObjectTemplate>::New(isolate, globalObjT emp);
228 » objTemp->Set(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsConst), v8::Ne wStringType::kNormal).ToLocalChecked(), pDefault, v8::ReadOnly); 228 » objTemp->Set(v8::String::NewFromUtf8(isolate, bsConst.c_str(), v8::NewSt ringType::kNormal).ToLocalChecked(), pDefault, v8::ReadOnly);
229 229
230 globalObjTemp.Reset(isolate,objTemp); 230 globalObjTemp.Reset(isolate,objTemp);
231 231
232 return 0; 232 return 0;
233 } 233 }
234 234
235 235
236 void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_ Context* context, v8::Global<v8::Context>& v8PersistentContext) 236 void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_ Context* context, v8::Global<v8::Context>& v8PersistentContext)
237 { 237 {
238 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime; 238 v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 { 1060 {
1061 return d != d; 1061 return d != d;
1062 } 1062 }
1063 1063
1064 double JS_LocalTime(double d) 1064 double JS_LocalTime(double d)
1065 { 1065 {
1066 return JS_GetDateTime() + _getDaylightSavingTA(d); 1066 return JS_GetDateTime() + _getDaylightSavingTA(d);
1067 } 1067 }
1068 1068
1069 //JavaScript time implement End. 1069 //JavaScript time implement End.
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/util.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698