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

Side by Side Diff: fpdfsdk/src/javascript/JS_Runtime.cpp

Issue 1767793002: Revert "Only place primitive objects on the V8 global template." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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 | « fpdfsdk/src/javascript/JS_Runtime.h ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | 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 "fpdfsdk/src/javascript/JS_Runtime.h" 7 #include "fpdfsdk/src/javascript/JS_Runtime.h"
8 8
9 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. 9 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment.
10 #include "fpdfsdk/include/javascript/IJavaScript.h" 10 #include "fpdfsdk/include/javascript/IJavaScript.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 249 }
250 250
251 void CJS_Runtime::RemoveEventFromSet(const FieldEvent& event) { 251 void CJS_Runtime::RemoveEventFromSet(const FieldEvent& event) {
252 m_FieldEventSet.erase(event); 252 m_FieldEventSet.erase(event);
253 } 253 }
254 254
255 v8::Local<v8::Context> CJS_Runtime::NewJSContext() { 255 v8::Local<v8::Context> CJS_Runtime::NewJSContext() {
256 return v8::Local<v8::Context>::New(m_isolate, m_context); 256 return v8::Local<v8::Context>::New(m_isolate, m_context);
257 } 257 }
258 258
259 void CJS_Runtime::SetConstArray(const CFX_WideString& name,
260 v8::Local<v8::Array> array) {
261 m_ConstArrays[name] = v8::Global<v8::Array>(m_isolate, array);
262 }
263
264 v8::Local<v8::Array> CJS_Runtime::GetConstArray(const CFX_WideString& name) {
265 return v8::Local<v8::Array>::New(m_isolate, m_ConstArrays[name]);
266 }
267
268 #ifdef PDF_ENABLE_XFA 259 #ifdef PDF_ENABLE_XFA
269 CFX_WideString ChangeObjName(const CFX_WideString& str) { 260 CFX_WideString ChangeObjName(const CFX_WideString& str) {
270 CFX_WideString sRet = str; 261 CFX_WideString sRet = str;
271 sRet.Replace(L"_", L"."); 262 sRet.Replace(L"_", L".");
272 return sRet; 263 return sRet;
273 } 264 }
274 FX_BOOL CJS_Runtime::GetHValueByName(const CFX_ByteStringC& utf8Name, 265 FX_BOOL CJS_Runtime::GetHValueByName(const CFX_ByteStringC& utf8Name,
275 FXJSE_HVALUE hValue) { 266 FXJSE_HVALUE hValue) {
276 #ifdef PDF_ENABLE_XFA 267 #ifdef PDF_ENABLE_XFA
277 const FX_CHAR* name = utf8Name.GetCStr(); 268 const FX_CHAR* name = utf8Name.GetCStr();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 #endif 326 #endif
336 void CJS_Runtime::AddObserver(Observer* observer) { 327 void CJS_Runtime::AddObserver(Observer* observer) {
337 ASSERT(!pdfium::ContainsKey(m_observers, observer)); 328 ASSERT(!pdfium::ContainsKey(m_observers, observer));
338 m_observers.insert(observer); 329 m_observers.insert(observer);
339 } 330 }
340 331
341 void CJS_Runtime::RemoveObserver(Observer* observer) { 332 void CJS_Runtime::RemoveObserver(Observer* observer) {
342 ASSERT(pdfium::ContainsKey(m_observers, observer)); 333 ASSERT(pdfium::ContainsKey(m_observers, observer));
343 m_observers.erase(observer); 334 m_observers.erase(observer);
344 } 335 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.h ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698