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

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

Issue 2036513002: Stop casting struct CFXJSE_ArgumentsImpl to unrelated class CFXJSE_Arguments (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Explicit ctor 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/class.cpp ('k') | no next file » | 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
11 static void FXJSE_DynPropGetterAdapter_MethodCallback( 11 static void FXJSE_DynPropGetterAdapter_MethodCallback(
12 const v8::FunctionCallbackInfo<v8::Value>& info) { 12 const v8::FunctionCallbackInfo<v8::Value>& info) {
13 v8::Local<v8::Object> hCallBackInfo = info.Data().As<v8::Object>(); 13 v8::Local<v8::Object> hCallBackInfo = info.Data().As<v8::Object>();
14 FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( 14 FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>(
15 hCallBackInfo->GetAlignedPointerFromInternalField(0)); 15 hCallBackInfo->GetAlignedPointerFromInternalField(0));
16 v8::Local<v8::String> hPropName = 16 v8::Local<v8::String> hPropName =
17 hCallBackInfo->GetInternalField(1).As<v8::String>(); 17 hCallBackInfo->GetInternalField(1).As<v8::String>();
18 ASSERT(lpClass && !hPropName.IsEmpty()); 18 ASSERT(lpClass && !hPropName.IsEmpty());
19 v8::String::Utf8Value szPropName(hPropName); 19 v8::String::Utf8Value szPropName(hPropName);
20 CFX_ByteStringC szFxPropName = *szPropName; 20 CFX_ByteStringC szFxPropName = *szPropName;
21 std::unique_ptr<CFXJSE_Value> lpThisValue( 21 std::unique_ptr<CFXJSE_Value> lpThisValue(
22 new CFXJSE_Value(info.GetIsolate())); 22 new CFXJSE_Value(info.GetIsolate()));
23 lpThisValue->ForceSetValue(info.This()); 23 lpThisValue->ForceSetValue(info.This());
24 std::unique_ptr<CFXJSE_Value> lpRetValue(new CFXJSE_Value(info.GetIsolate())); 24 std::unique_ptr<CFXJSE_Value> lpRetValue(new CFXJSE_Value(info.GetIsolate()));
25 CFXJSE_ArgumentsImpl impl = {&info, lpRetValue.get()}; 25 CFXJSE_Arguments impl(&info, lpRetValue.get());
26 lpClass->dynMethodCall(lpThisValue.get(), szFxPropName, 26 lpClass->dynMethodCall(lpThisValue.get(), szFxPropName, impl);
27 reinterpret_cast<CFXJSE_Arguments&>(impl));
28 if (!lpRetValue->DirectGetValue().IsEmpty()) { 27 if (!lpRetValue->DirectGetValue().IsEmpty()) {
29 info.GetReturnValue().Set(lpRetValue->DirectGetValue()); 28 info.GetReturnValue().Set(lpRetValue->DirectGetValue());
30 } 29 }
31 } 30 }
32 31
33 static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, 32 static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
34 CFXJSE_Value* pObject, 33 CFXJSE_Value* pObject,
35 const CFX_ByteStringC& szPropName, 34 const CFX_ByteStringC& szPropName,
36 CFXJSE_Value* pValue) { 35 CFXJSE_Value* pValue) {
37 ASSERT(lpClass); 36 ASSERT(lpClass);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 : 0, 214 : 0,
216 lpClassDefinition->dynPropDeleter 215 lpClassDefinition->dynPropDeleter
217 ? FXJSE_V8_GenericNamedPropertyDeleterCallback 216 ? FXJSE_V8_GenericNamedPropertyDeleterCallback
218 : 0, 217 : 0,
219 FXJSE_V8_GenericNamedPropertyEnumeratorCallback, 218 FXJSE_V8_GenericNamedPropertyEnumeratorCallback,
220 v8::External::New(pIsolate, 219 v8::External::New(pIsolate,
221 const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)), 220 const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)),
222 v8::PropertyHandlerFlags::kNonMasking); 221 v8::PropertyHandlerFlags::kNonMasking);
223 hObjectTemplate->SetHandler(configuration); 222 hObjectTemplate->SetHandler(configuration);
224 } 223 }
OLDNEW
« no previous file with comments | « xfa/fxjse/class.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698