| 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 "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
| 8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
| 9 #include "../../include/javascript/JS_EventHandler.h" | 9 #include "../../include/javascript/JS_EventHandler.h" |
| 10 #include "../../include/javascript/JS_Runtime.h" | 10 #include "../../include/javascript/JS_Runtime.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 void CJS_ArrayBufferAllocator::Free(void* data, size_t length) { | 103 void CJS_ArrayBufferAllocator::Free(void* data, size_t length) { |
| 104 free(data); | 104 free(data); |
| 105 } | 105 } |
| 106 | 106 |
| 107 /* ------------------------------ CJS_Runtime ------------------------------ */ | 107 /* ------------------------------ CJS_Runtime ------------------------------ */ |
| 108 extern v8::Global<v8::ObjectTemplate>& _getGlobalObjectTemplate(IJS_Runtime* pJS
Runtime); | 108 extern v8::Global<v8::ObjectTemplate>& _getGlobalObjectTemplate(IJS_Runtime* pJS
Runtime); |
| 109 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) : | 109 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) : |
| 110 m_pApp(pApp), | 110 m_pApp(pApp), |
| 111 m_pDocument(NULL), | 111 m_pDocument(NULL), |
| 112 m_bBlocking(FALSE), | 112 m_bBlocking(FALSE), |
| 113 m_bRegistered(FALSE), | |
| 114 m_pFieldEventPath(NULL) | 113 m_pFieldEventPath(NULL) |
| 115 { | 114 { |
| 116 if (CPDFXFA_App::GetInstance()->GetJSERuntime()) { | 115 if (CPDFXFA_App::GetInstance()->GetJSERuntime()) { |
| 117 m_isolate = (v8::Isolate*)CPDFXFA_App::GetInstance()->GetJSERunt
ime(); | 116 m_isolate = (v8::Isolate*)CPDFXFA_App::GetInstance()->GetJSERunt
ime(); |
| 118 } else { | 117 } else { |
| 119 m_pArrayBufferAllocator.reset(new CJS_ArrayBufferAllocator()); | 118 m_pArrayBufferAllocator.reset(new CJS_ArrayBufferAllocator()); |
| 120 v8::Isolate::CreateParams params; | 119 v8::Isolate::CreateParams params; |
| 121 params.array_buffer_allocator = m_pArrayBufferAllocator.get(); | 120 params.array_buffer_allocator = m_pArrayBufferAllocator.get(); |
| 122 m_isolate = v8::Isolate::New(params); | 121 m_isolate = v8::Isolate::New(params); |
| 123 } | 122 } |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 v8::Local<v8::Context> context = | 392 v8::Local<v8::Context> context = |
| 394 v8::Local<v8::Context>::New(pIsolate, m_context); | 393 v8::Local<v8::Context>::New(pIsolate, m_context); |
| 395 v8::Context::Scope context_scope(context); | 394 v8::Context::Scope context_scope(context); |
| 396 | 395 |
| 397 //v8::Local<v8::Context> tmpCotext = v8::Local<v8::Context>::New(GetIsol
ate(), m_context); | 396 //v8::Local<v8::Context> tmpCotext = v8::Local<v8::Context>::New(GetIsol
ate(), m_context); |
| 398 v8::Local<v8::Value> propvalue = v8::Local<v8::Value>::New(GetIsolate(),
((CFXJSE_Value*)hValue)->DirectGetValue()); | 397 v8::Local<v8::Value> propvalue = v8::Local<v8::Value>::New(GetIsolate(),
((CFXJSE_Value*)hValue)->DirectGetValue()); |
| 399 context->Global()->Set(v8::String::NewFromUtf8(pIsolate, name, v8::Strin
g::kNormalString, utf8Name.GetLength()), propvalue); | 398 context->Global()->Set(v8::String::NewFromUtf8(pIsolate, name, v8::Strin
g::kNormalString, utf8Name.GetLength()), propvalue); |
| 400 | 399 |
| 401 return TRUE; | 400 return TRUE; |
| 402 } | 401 } |
| OLD | NEW |