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

Side by Side Diff: fxjs/cfxjse_class.cpp

Issue 2471353002: Remove FX_BOOL entirely. (Closed)
Patch Set: Fix nits now rather than later Created 4 years, 1 month 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 | « fxjs/cfxjse_class.h ('k') | fxjs/cfxjse_context.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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "fxjs/cfxjse_class.h" 7 #include "fxjs/cfxjse_class.h"
8 8
9 #include "fxjs/cfxjse_context.h" 9 #include "fxjs/cfxjse_context.h"
10 #include "fxjs/cfxjse_value.h" 10 #include "fxjs/cfxjse_value.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 void DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, 146 void DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
147 CFXJSE_Value* pObject, 147 CFXJSE_Value* pObject,
148 const CFX_ByteStringC& szPropName, 148 const CFX_ByteStringC& szPropName,
149 CFXJSE_Value* pValue) { 149 CFXJSE_Value* pValue) {
150 ASSERT(lpClass); 150 ASSERT(lpClass);
151 int32_t nPropType = 151 int32_t nPropType =
152 lpClass->dynPropTypeGetter == nullptr 152 lpClass->dynPropTypeGetter == nullptr
153 ? FXJSE_ClassPropType_Property 153 ? FXJSE_ClassPropType_Property
154 : lpClass->dynPropTypeGetter(pObject, szPropName, FALSE); 154 : lpClass->dynPropTypeGetter(pObject, szPropName, false);
155 if (nPropType == FXJSE_ClassPropType_Property) { 155 if (nPropType == FXJSE_ClassPropType_Property) {
156 if (lpClass->dynPropGetter) 156 if (lpClass->dynPropGetter)
157 lpClass->dynPropGetter(pObject, szPropName, pValue); 157 lpClass->dynPropGetter(pObject, szPropName, pValue);
158 } else if (nPropType == FXJSE_ClassPropType_Method) { 158 } else if (nPropType == FXJSE_ClassPropType_Method) {
159 if (lpClass->dynMethodCall && pValue) { 159 if (lpClass->dynMethodCall && pValue) {
160 v8::Isolate* pIsolate = pValue->GetIsolate(); 160 v8::Isolate* pIsolate = pValue->GetIsolate();
161 v8::HandleScope hscope(pIsolate); 161 v8::HandleScope hscope(pIsolate);
162 v8::Local<v8::ObjectTemplate> hCallBackInfoTemplate = 162 v8::Local<v8::ObjectTemplate> hCallBackInfoTemplate =
163 v8::ObjectTemplate::New(pIsolate); 163 v8::ObjectTemplate::New(pIsolate);
164 hCallBackInfoTemplate->SetInternalFieldCount(2); 164 hCallBackInfoTemplate->SetInternalFieldCount(2);
(...skipping 15 matching lines...) Expand all
180 } 180 }
181 181
182 void DynPropSetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, 182 void DynPropSetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
183 CFXJSE_Value* pObject, 183 CFXJSE_Value* pObject,
184 const CFX_ByteStringC& szPropName, 184 const CFX_ByteStringC& szPropName,
185 CFXJSE_Value* pValue) { 185 CFXJSE_Value* pValue) {
186 ASSERT(lpClass); 186 ASSERT(lpClass);
187 int32_t nPropType = 187 int32_t nPropType =
188 lpClass->dynPropTypeGetter == nullptr 188 lpClass->dynPropTypeGetter == nullptr
189 ? FXJSE_ClassPropType_Property 189 ? FXJSE_ClassPropType_Property
190 : lpClass->dynPropTypeGetter(pObject, szPropName, FALSE); 190 : lpClass->dynPropTypeGetter(pObject, szPropName, false);
191 if (nPropType != FXJSE_ClassPropType_Method) { 191 if (nPropType != FXJSE_ClassPropType_Method) {
192 if (lpClass->dynPropSetter) 192 if (lpClass->dynPropSetter)
193 lpClass->dynPropSetter(pObject, szPropName, pValue); 193 lpClass->dynPropSetter(pObject, szPropName, pValue);
194 } 194 }
195 } 195 }
196 196
197 FX_BOOL DynPropQueryAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, 197 bool DynPropQueryAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
198 CFXJSE_Value* pObject, 198 CFXJSE_Value* pObject,
199 const CFX_ByteStringC& szPropName) { 199 const CFX_ByteStringC& szPropName) {
200 ASSERT(lpClass); 200 ASSERT(lpClass);
201 int32_t nPropType = 201 int32_t nPropType =
202 lpClass->dynPropTypeGetter == nullptr 202 lpClass->dynPropTypeGetter == nullptr
203 ? FXJSE_ClassPropType_Property 203 ? FXJSE_ClassPropType_Property
204 : lpClass->dynPropTypeGetter(pObject, szPropName, TRUE); 204 : lpClass->dynPropTypeGetter(pObject, szPropName, true);
205 return nPropType != FXJSE_ClassPropType_None; 205 return nPropType != FXJSE_ClassPropType_None;
206 } 206 }
207 207
208 FX_BOOL DynPropDeleterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, 208 bool DynPropDeleterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
209 CFXJSE_Value* pObject, 209 CFXJSE_Value* pObject,
210 const CFX_ByteStringC& szPropName) { 210 const CFX_ByteStringC& szPropName) {
211 ASSERT(lpClass); 211 ASSERT(lpClass);
212 int32_t nPropType = 212 int32_t nPropType =
213 lpClass->dynPropTypeGetter == nullptr 213 lpClass->dynPropTypeGetter == nullptr
214 ? FXJSE_ClassPropType_Property 214 ? FXJSE_ClassPropType_Property
215 : lpClass->dynPropTypeGetter(pObject, szPropName, FALSE); 215 : lpClass->dynPropTypeGetter(pObject, szPropName, false);
216 if (nPropType != FXJSE_ClassPropType_Method) { 216 if (nPropType != FXJSE_ClassPropType_Method) {
217 if (lpClass->dynPropDeleter) 217 if (lpClass->dynPropDeleter)
218 return lpClass->dynPropDeleter(pObject, szPropName); 218 return lpClass->dynPropDeleter(pObject, szPropName);
219 return nPropType == FXJSE_ClassPropType_Property ? FALSE : TRUE; 219 return nPropType != FXJSE_ClassPropType_Property;
220 } 220 }
221 return FALSE; 221 return false;
222 } 222 }
223 223
224 void NamedPropertyQueryCallback( 224 void NamedPropertyQueryCallback(
225 v8::Local<v8::Name> property, 225 v8::Local<v8::Name> property,
226 const v8::PropertyCallbackInfo<v8::Integer>& info) { 226 const v8::PropertyCallbackInfo<v8::Integer>& info) {
227 v8::Local<v8::Object> thisObject = info.This(); 227 v8::Local<v8::Object> thisObject = info.This();
228 const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( 228 const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
229 info.Data().As<v8::External>()->Value()); 229 info.Data().As<v8::External>()->Value());
230 v8::Isolate* pIsolate = info.GetIsolate(); 230 v8::Isolate* pIsolate = info.GetIsolate();
231 v8::HandleScope scope(pIsolate); 231 v8::HandleScope scope(pIsolate);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 308 }
309 info.GetReturnValue().Set(newArray); 309 info.GetReturnValue().Set(newArray);
310 } 310 }
311 311
312 } // namespace 312 } // namespace
313 313
314 // static 314 // static
315 CFXJSE_Class* CFXJSE_Class::Create( 315 CFXJSE_Class* CFXJSE_Class::Create(
316 CFXJSE_Context* lpContext, 316 CFXJSE_Context* lpContext,
317 const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition, 317 const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition,
318 FX_BOOL bIsJSGlobal) { 318 bool bIsJSGlobal) {
319 if (!lpContext || !lpClassDefinition) 319 if (!lpContext || !lpClassDefinition)
320 return nullptr; 320 return nullptr;
321 321
322 CFXJSE_Class* pClass = 322 CFXJSE_Class* pClass =
323 GetClassFromContext(lpContext, lpClassDefinition->name); 323 GetClassFromContext(lpContext, lpClassDefinition->name);
324 if (pClass) 324 if (pClass)
325 return pClass; 325 return pClass;
326 326
327 v8::Isolate* pIsolate = lpContext->m_pIsolate; 327 v8::Isolate* pIsolate = lpContext->m_pIsolate;
328 pClass = new CFXJSE_Class(lpContext); 328 pClass = new CFXJSE_Class(lpContext);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 v8::External::New(pIsolate, 425 v8::External::New(pIsolate,
426 const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)), 426 const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)),
427 v8::PropertyHandlerFlags::kNonMasking); 427 v8::PropertyHandlerFlags::kNonMasking);
428 hObjectTemplate->SetHandler(configuration); 428 hObjectTemplate->SetHandler(configuration);
429 } 429 }
430 430
431 CFXJSE_Class::CFXJSE_Class(CFXJSE_Context* lpContext) 431 CFXJSE_Class::CFXJSE_Class(CFXJSE_Context* lpContext)
432 : m_lpClassDefinition(nullptr), m_pContext(lpContext) {} 432 : m_lpClassDefinition(nullptr), m_pContext(lpContext) {}
433 433
434 CFXJSE_Class::~CFXJSE_Class() {} 434 CFXJSE_Class::~CFXJSE_Class() {}
OLDNEW
« no previous file with comments | « fxjs/cfxjse_class.h ('k') | fxjs/cfxjse_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698