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 "fxjse/include/cfxjse_value.h" | 7 #include "fxjse/include/cfxjse_value.h" |
8 | 8 |
9 #include <math.h> | 9 #include <math.h> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 ASSERT(pIsolate); | 57 ASSERT(pIsolate); |
58 | 58 |
59 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); | 59 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); |
60 v8::Local<v8::String> hMessage = v8::String::NewFromUtf8( | 60 v8::Local<v8::String> hMessage = v8::String::NewFromUtf8( |
61 pIsolate, utf8Message.c_str(), v8::String::kNormalString, | 61 pIsolate, utf8Message.c_str(), v8::String::kNormalString, |
62 utf8Message.GetLength()); | 62 utf8Message.GetLength()); |
63 v8::Local<v8::Value> hError = v8::Exception::Error(hMessage); | 63 v8::Local<v8::Value> hError = v8::Exception::Error(hMessage); |
64 pIsolate->ThrowException(hError); | 64 pIsolate->ThrowException(hError); |
65 } | 65 } |
66 | 66 |
| 67 CFXJSE_Value::CFXJSE_Value(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} |
| 68 |
| 69 CFXJSE_Value::~CFXJSE_Value() {} |
| 70 |
67 CFXJSE_HostObject* CFXJSE_Value::ToHostObject(CFXJSE_Class* lpClass) const { | 71 CFXJSE_HostObject* CFXJSE_Value::ToHostObject(CFXJSE_Class* lpClass) const { |
68 ASSERT(!m_hValue.IsEmpty()); | 72 ASSERT(!m_hValue.IsEmpty()); |
69 | 73 |
70 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); | 74 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); |
71 v8::Local<v8::Value> pValue = v8::Local<v8::Value>::New(m_pIsolate, m_hValue); | 75 v8::Local<v8::Value> pValue = v8::Local<v8::Value>::New(m_pIsolate, m_hValue); |
72 ASSERT(!pValue.IsEmpty()); | 76 ASSERT(!pValue.IsEmpty()); |
73 | 77 |
74 if (!pValue->IsObject()) | 78 if (!pValue->IsObject()) |
75 return nullptr; | 79 return nullptr; |
76 | 80 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 if (lpRetValue) | 339 if (lpRetValue) |
336 lpRetValue->ForceSetValue(hReturnValue); | 340 lpRetValue->ForceSetValue(hReturnValue); |
337 | 341 |
338 if (lpLocalArgs) { | 342 if (lpLocalArgs) { |
339 for (uint32_t i = 0; i < nArgCount; i++) | 343 for (uint32_t i = 0; i < nArgCount; i++) |
340 lpLocalArgs[i].~Local(); | 344 lpLocalArgs[i].~Local(); |
341 FX_Free(lpLocalArgs); | 345 FX_Free(lpLocalArgs); |
342 } | 346 } |
343 return bRetValue; | 347 return bRetValue; |
344 } | 348 } |
OLD | NEW |