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

Side by Side Diff: xfa/fxjse/dynprop.cpp

Issue 2031873003: Get rid of NULLs in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_fpdfsdk
Patch Set: Created 4 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 | « xfa/fxjse/context.cpp ('k') | xfa/fxjse/value.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 "xfa/fxjse/cfxjse_arguments.h" 7 #include "xfa/fxjse/cfxjse_arguments.h"
8 #include "xfa/fxjse/class.h" 8 #include "xfa/fxjse/class.h"
9 #include "xfa/fxjse/value.h" 9 #include "xfa/fxjse/value.h"
10 10
(...skipping 15 matching lines...) Expand all
26 lpClass->dynMethodCall(lpThisValue.get(), szFxPropName, impl); 26 lpClass->dynMethodCall(lpThisValue.get(), szFxPropName, impl);
27 if (!lpRetValue->DirectGetValue().IsEmpty()) { 27 if (!lpRetValue->DirectGetValue().IsEmpty()) {
28 info.GetReturnValue().Set(lpRetValue->DirectGetValue()); 28 info.GetReturnValue().Set(lpRetValue->DirectGetValue());
29 } 29 }
30 } 30 }
31 31
32 static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, 32 static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
33 CFXJSE_Value* pObject, 33 CFXJSE_Value* pObject,
34 const CFX_ByteStringC& szPropName, 34 const CFX_ByteStringC& szPropName,
35 CFXJSE_Value* pValue) { 35 CFXJSE_Value* pValue) {
36 ASSERT(lpClass);
37 int32_t nPropType = 36 int32_t nPropType =
38 lpClass->dynPropTypeGetter == nullptr 37 lpClass->dynPropTypeGetter
39 ? FXJSE_ClassPropType_Property 38 ? lpClass->dynPropTypeGetter(pObject, szPropName, FALSE)
40 : lpClass->dynPropTypeGetter(pObject, szPropName, FALSE); 39 : FXJSE_ClassPropType_Property;
41 if (nPropType == FXJSE_ClassPropType_Property) { 40 if (nPropType == FXJSE_ClassPropType_Property) {
42 if (lpClass->dynPropGetter) { 41 if (lpClass->dynPropGetter) {
43 lpClass->dynPropGetter(pObject, szPropName, pValue); 42 lpClass->dynPropGetter(pObject, szPropName, pValue);
44 } 43 }
45 } else if (nPropType == FXJSE_ClassPropType_Method) { 44 } else if (nPropType == FXJSE_ClassPropType_Method) {
46 if (lpClass->dynMethodCall && pValue) { 45 if (lpClass->dynMethodCall && pValue) {
47 v8::Isolate* pIsolate = pValue->GetIsolate(); 46 v8::Isolate* pIsolate = pValue->GetIsolate();
48 v8::HandleScope hscope(pIsolate); 47 v8::HandleScope hscope(pIsolate);
49 v8::Local<v8::ObjectTemplate> hCallBackInfoTemplate = 48 v8::Local<v8::ObjectTemplate> hCallBackInfoTemplate =
50 v8::ObjectTemplate::New(pIsolate); 49 v8::ObjectTemplate::New(pIsolate);
(...skipping 10 matching lines...) Expand all
61 pValue->GetIsolate(), FXJSE_DynPropGetterAdapter_MethodCallback, 60 pValue->GetIsolate(), FXJSE_DynPropGetterAdapter_MethodCallback,
62 hCallBackInfo)); 61 hCallBackInfo));
63 } 62 }
64 } 63 }
65 } 64 }
66 65
67 static void FXJSE_DynPropSetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, 66 static void FXJSE_DynPropSetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
68 CFXJSE_Value* pObject, 67 CFXJSE_Value* pObject,
69 const CFX_ByteStringC& szPropName, 68 const CFX_ByteStringC& szPropName,
70 CFXJSE_Value* pValue) { 69 CFXJSE_Value* pValue) {
71 ASSERT(lpClass);
72 int32_t nPropType = 70 int32_t nPropType =
73 lpClass->dynPropTypeGetter == nullptr 71 lpClass->dynPropTypeGetter
74 ? FXJSE_ClassPropType_Property 72 ? lpClass->dynPropTypeGetter(pObject, szPropName, FALSE)
75 : lpClass->dynPropTypeGetter(pObject, szPropName, FALSE); 73 : FXJSE_ClassPropType_Property;
76 if (nPropType != FXJSE_ClassPropType_Method) { 74 if (nPropType != FXJSE_ClassPropType_Method) {
77 if (lpClass->dynPropSetter) { 75 if (lpClass->dynPropSetter) {
78 lpClass->dynPropSetter(pObject, szPropName, pValue); 76 lpClass->dynPropSetter(pObject, szPropName, pValue);
79 } 77 }
80 } 78 }
81 } 79 }
82 80
83 static FX_BOOL FXJSE_DynPropQueryAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, 81 static FX_BOOL FXJSE_DynPropQueryAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
84 CFXJSE_Value* pObject, 82 CFXJSE_Value* pObject,
85 const CFX_ByteStringC& szPropName) { 83 const CFX_ByteStringC& szPropName) {
86 ASSERT(lpClass);
87 int32_t nPropType = 84 int32_t nPropType =
88 lpClass->dynPropTypeGetter == nullptr 85 lpClass->dynPropTypeGetter
89 ? FXJSE_ClassPropType_Property 86 ? lpClass->dynPropTypeGetter(pObject, szPropName, TRUE)
90 : lpClass->dynPropTypeGetter(pObject, szPropName, TRUE); 87 : FXJSE_ClassPropType_Property;
91 return nPropType != FXJSE_ClassPropType_None; 88 return nPropType != FXJSE_ClassPropType_None;
92 } 89 }
93 90
94 static FX_BOOL FXJSE_DynPropDeleterAdapter( 91 static FX_BOOL FXJSE_DynPropDeleterAdapter(
95 const FXJSE_CLASS_DESCRIPTOR* lpClass, 92 const FXJSE_CLASS_DESCRIPTOR* lpClass,
96 CFXJSE_Value* pObject, 93 CFXJSE_Value* pObject,
97 const CFX_ByteStringC& szPropName) { 94 const CFX_ByteStringC& szPropName) {
98 ASSERT(lpClass);
99 int32_t nPropType = 95 int32_t nPropType =
100 lpClass->dynPropTypeGetter == nullptr 96 lpClass->dynPropTypeGetter
101 ? FXJSE_ClassPropType_Property 97 ? lpClass->dynPropTypeGetter(pObject, szPropName, FALSE)
102 : lpClass->dynPropTypeGetter(pObject, szPropName, FALSE); 98 : FXJSE_ClassPropType_Property;
103 if (nPropType != FXJSE_ClassPropType_Method) { 99 if (nPropType == FXJSE_ClassPropType_Method)
104 if (lpClass->dynPropDeleter) { 100 return FALSE;
105 return lpClass->dynPropDeleter(pObject, szPropName); 101 if (lpClass->dynPropDeleter)
106 } else { 102 return lpClass->dynPropDeleter(pObject, szPropName);
107 return nPropType == FXJSE_ClassPropType_Property ? FALSE : TRUE; 103 return nPropType != FXJSE_ClassPropType_Property;
108 }
109 }
110 return FALSE;
111 } 104 }
112 105
113 static void FXJSE_V8_GenericNamedPropertyQueryCallback( 106 static void FXJSE_V8_GenericNamedPropertyQueryCallback(
114 v8::Local<v8::Name> property, 107 v8::Local<v8::Name> property,
115 const v8::PropertyCallbackInfo<v8::Integer>& info) { 108 const v8::PropertyCallbackInfo<v8::Integer>& info) {
116 v8::Local<v8::Object> thisObject = info.This(); 109 v8::Local<v8::Object> thisObject = info.This();
117 const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( 110 const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
118 info.Data().As<v8::External>()->Value()); 111 info.Data().As<v8::External>()->Value());
119 v8::Isolate* pIsolate = info.GetIsolate(); 112 v8::Isolate* pIsolate = info.GetIsolate();
120 v8::HandleScope scope(pIsolate); 113 v8::HandleScope scope(pIsolate);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 : 0, 207 : 0,
215 lpClassDefinition->dynPropDeleter 208 lpClassDefinition->dynPropDeleter
216 ? FXJSE_V8_GenericNamedPropertyDeleterCallback 209 ? FXJSE_V8_GenericNamedPropertyDeleterCallback
217 : 0, 210 : 0,
218 FXJSE_V8_GenericNamedPropertyEnumeratorCallback, 211 FXJSE_V8_GenericNamedPropertyEnumeratorCallback,
219 v8::External::New(pIsolate, 212 v8::External::New(pIsolate,
220 const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)), 213 const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)),
221 v8::PropertyHandlerFlags::kNonMasking); 214 v8::PropertyHandlerFlags::kNonMasking);
222 hObjectTemplate->SetHandler(configuration); 215 hObjectTemplate->SetHandler(configuration);
223 } 216 }
OLDNEW
« no previous file with comments | « xfa/fxjse/context.cpp ('k') | xfa/fxjse/value.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698