| OLD | NEW |
| 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 "fpdfsdk/javascript/JS_Value.h" | 7 #include "fpdfsdk/javascript/JS_Value.h" |
| 8 | 8 |
| 9 #include <time.h> | 9 #include <time.h> |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 CJS_Value::~CJS_Value() {} | 70 CJS_Value::~CJS_Value() {} |
| 71 | 71 |
| 72 CJS_Value::CJS_Value(const CJS_Value& other) = default; | 72 CJS_Value::CJS_Value(const CJS_Value& other) = default; |
| 73 | 73 |
| 74 void CJS_Value::Attach(v8::Local<v8::Value> pValue) { | 74 void CJS_Value::Attach(v8::Local<v8::Value> pValue) { |
| 75 m_pValue = pValue; | 75 m_pValue = pValue; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void CJS_Value::Attach(CJS_Value* pValue) { | |
| 79 if (pValue) | |
| 80 Attach(pValue->ToV8Value()); | |
| 81 } | |
| 82 | |
| 83 void CJS_Value::Detach() { | 78 void CJS_Value::Detach() { |
| 84 m_pValue = v8::Local<v8::Value>(); | 79 m_pValue = v8::Local<v8::Value>(); |
| 85 } | 80 } |
| 86 | 81 |
| 87 int CJS_Value::ToInt() const { | 82 int CJS_Value::ToInt() const { |
| 88 return FXJS_ToInt32(m_pJSRuntime->GetIsolate(), m_pValue); | 83 return FXJS_ToInt32(m_pJSRuntime->GetIsolate(), m_pValue); |
| 89 } | 84 } |
| 90 | 85 |
| 91 bool CJS_Value::ToBool() const { | 86 bool CJS_Value::ToBool() const { |
| 92 return FXJS_ToBoolean(m_pJSRuntime->GetIsolate(), m_pValue); | 87 return FXJS_ToBoolean(m_pJSRuntime->GetIsolate(), m_pValue); |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 for (size_t i = 0; i < nKeywords; ++i) { | 859 for (size_t i = 0; i < nKeywords; ++i) { |
| 865 const wchar_t* property = va_arg(ap, const wchar_t*); | 860 const wchar_t* property = va_arg(ap, const wchar_t*); |
| 866 v8::Local<v8::Value> v8Value = | 861 v8::Local<v8::Value> v8Value = |
| 867 FXJS_GetObjectElement(pRuntime->GetIsolate(), pObj, property); | 862 FXJS_GetObjectElement(pRuntime->GetIsolate(), pObj, property); |
| 868 if (!v8Value->IsUndefined()) | 863 if (!v8Value->IsUndefined()) |
| 869 result[i] = CJS_Value(pRuntime, v8Value); | 864 result[i] = CJS_Value(pRuntime, v8Value); |
| 870 } | 865 } |
| 871 va_end(ap); | 866 va_end(ap); |
| 872 return result; | 867 return result; |
| 873 } | 868 } |
| OLD | NEW |