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

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

Issue 1348393007: Merge to XFA: Remove CJS_RuntimeFactory (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 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/fsdk_mgr.cpp ('k') | no next file » | 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 "../../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 11 matching lines...) Expand all
22 #include "../../include/javascript/Icon.h" 22 #include "../../include/javascript/Icon.h"
23 #include "../../include/javascript/PublicMethods.h" 23 #include "../../include/javascript/PublicMethods.h"
24 #include "../../include/javascript/report.h" 24 #include "../../include/javascript/report.h"
25 #include "../../include/javascript/util.h" 25 #include "../../include/javascript/util.h"
26 #include "../../include/javascript/JS_GlobalData.h" 26 #include "../../include/javascript/JS_GlobalData.h"
27 #include "../../include/javascript/global.h" 27 #include "../../include/javascript/global.h"
28 #include "../../include/javascript/console.h" 28 #include "../../include/javascript/console.h"
29 #include "../../include/fpdfxfa/fpdfxfa_app.h" 29 #include "../../include/fpdfxfa/fpdfxfa_app.h"
30 #include "../../../xfa/src/fxjse/src/value.h" 30 #include "../../../xfa/src/fxjse/src/value.h"
31 31
32 CJS_RuntimeFactory::~CJS_RuntimeFactory() {}
33
34 IFXJS_Runtime* CJS_RuntimeFactory::NewJSRuntime(CPDFDoc_Environment* pApp) {
35 m_bInit = true;
36 return new CJS_Runtime(pApp);
37 }
38 void CJS_RuntimeFactory::AddRef() {
39 m_nRef++;
40 }
41 void CJS_RuntimeFactory::Release() {
42 if (m_bInit) {
43 if (--m_nRef == 0) {
44 FXJS_Release();
45 m_bInit = FALSE;
46 }
47 }
48 }
49
50 void CJS_RuntimeFactory::DeleteJSRuntime(IFXJS_Runtime* pRuntime) {
51 delete (CJS_Runtime*)pRuntime;
52 }
53
54 /* ------------------------------ CJS_Runtime ------------------------------ */ 32 /* ------------------------------ CJS_Runtime ------------------------------ */
55 v8::Global<v8::ObjectTemplate>& _getGlobalObjectTemplate(v8::Isolate* pIsolate); 33 v8::Global<v8::ObjectTemplate>& _getGlobalObjectTemplate(v8::Isolate* pIsolate);
56 34
57 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) 35 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
58 : m_pApp(pApp), 36 : m_pApp(pApp),
59 m_pDocument(NULL), 37 m_pDocument(NULL),
60 m_bBlocking(FALSE), 38 m_bBlocking(FALSE),
61 m_pFieldEventPath(NULL), 39 m_pFieldEventPath(NULL),
62 m_isolate(NULL), 40 m_isolate(NULL),
63 m_isolateManaged(false) { 41 m_isolateManaged(false) {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // v8::Local<v8::Context>::New(GetIsolate(), m_context); 315 // v8::Local<v8::Context>::New(GetIsolate(), m_context);
338 v8::Local<v8::Value> propvalue = v8::Local<v8::Value>::New( 316 v8::Local<v8::Value> propvalue = v8::Local<v8::Value>::New(
339 GetIsolate(), ((CFXJSE_Value*)hValue)->DirectGetValue()); 317 GetIsolate(), ((CFXJSE_Value*)hValue)->DirectGetValue());
340 context->Global()->Set( 318 context->Global()->Set(
341 v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString, 319 v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString,
342 utf8Name.GetLength()), 320 utf8Name.GetLength()),
343 propvalue); 321 propvalue);
344 322
345 return TRUE; 323 return TRUE;
346 } 324 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_mgr.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698