| OLD | NEW |
| 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/include/cfxjse_class.h" | 7 #include "fxjs/include/cfxjse_class.h" |
| 8 | 8 |
| 9 #include "fxjs/include/cfxjse_context.h" | 9 #include "fxjs/include/cfxjse_context.h" |
| 10 #include "fxjs/include/cfxjse_value.h" | 10 #include "fxjs/include/cfxjse_value.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 const v8::PropertyCallbackInfo<v8::Value>& info) { | 282 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 283 v8::Local<v8::Object> thisObject = info.This(); | 283 v8::Local<v8::Object> thisObject = info.This(); |
| 284 const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( | 284 const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( |
| 285 info.Data().As<v8::External>()->Value()); | 285 info.Data().As<v8::External>()->Value()); |
| 286 v8::String::Utf8Value szPropName(property); | 286 v8::String::Utf8Value szPropName(property); |
| 287 CFX_ByteStringC szFxPropName(*szPropName, szPropName.length()); | 287 CFX_ByteStringC szFxPropName(*szPropName, szPropName.length()); |
| 288 std::unique_ptr<CFXJSE_Value> lpThisValue( | 288 std::unique_ptr<CFXJSE_Value> lpThisValue( |
| 289 new CFXJSE_Value(info.GetIsolate())); | 289 new CFXJSE_Value(info.GetIsolate())); |
| 290 lpThisValue->ForceSetValue(thisObject); | 290 lpThisValue->ForceSetValue(thisObject); |
| 291 | 291 |
| 292 CFXJSE_Value* lpNewValue = new CFXJSE_Value(info.GetIsolate()); | 292 std::unique_ptr<CFXJSE_Value> lpNewValue(new CFXJSE_Value(info.GetIsolate())); |
| 293 lpNewValue->ForceSetValue(value); | 293 lpNewValue->ForceSetValue(value); |
| 294 DynPropSetterAdapter(lpClass, lpThisValue.get(), szFxPropName, lpNewValue); | 294 DynPropSetterAdapter(lpClass, lpThisValue.get(), szFxPropName, |
| 295 lpNewValue.get()); |
| 295 info.GetReturnValue().Set(value); | 296 info.GetReturnValue().Set(value); |
| 296 } | 297 } |
| 297 | 298 |
| 298 void NamedPropertyEnumeratorCallback( | 299 void NamedPropertyEnumeratorCallback( |
| 299 const v8::PropertyCallbackInfo<v8::Array>& info) { | 300 const v8::PropertyCallbackInfo<v8::Array>& info) { |
| 300 const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( | 301 const FXJSE_CLASS_DESCRIPTOR* lpClass = static_cast<FXJSE_CLASS_DESCRIPTOR*>( |
| 301 info.Data().As<v8::External>()->Value()); | 302 info.Data().As<v8::External>()->Value()); |
| 302 v8::Isolate* pIsolate = info.GetIsolate(); | 303 v8::Isolate* pIsolate = info.GetIsolate(); |
| 303 v8::Local<v8::Array> newArray = v8::Array::New(pIsolate, lpClass->propNum); | 304 v8::Local<v8::Array> newArray = v8::Array::New(pIsolate, lpClass->propNum); |
| 304 for (int i = 0; i < lpClass->propNum; i++) { | 305 for (int i = 0; i < lpClass->propNum; i++) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 v8::External::New(pIsolate, | 425 v8::External::New(pIsolate, |
| 425 const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)), | 426 const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)), |
| 426 v8::PropertyHandlerFlags::kNonMasking); | 427 v8::PropertyHandlerFlags::kNonMasking); |
| 427 hObjectTemplate->SetHandler(configuration); | 428 hObjectTemplate->SetHandler(configuration); |
| 428 } | 429 } |
| 429 | 430 |
| 430 CFXJSE_Class::CFXJSE_Class(CFXJSE_Context* lpContext) | 431 CFXJSE_Class::CFXJSE_Class(CFXJSE_Context* lpContext) |
| 431 : m_lpClassDefinition(nullptr), m_pContext(lpContext) {} | 432 : m_lpClassDefinition(nullptr), m_pContext(lpContext) {} |
| 432 | 433 |
| 433 CFXJSE_Class::~CFXJSE_Class() {} | 434 CFXJSE_Class::~CFXJSE_Class() {} |
| OLD | NEW |