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

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

Issue 374123002: Hook up the default v8::Platform implementation to pdfium (Closed) Base URL: https://pdfium.googlesource.com/pdfium/@master
Patch Set: updates Created 6 years, 5 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/include/javascript/IJavaScript.h ('k') | pdfium.gyp » ('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 "../../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"
11 #include "../../include/javascript/JS_Context.h" 11 #include "../../include/javascript/JS_Context.h"
12 #include "../../include/javascript/JS_Define.h" 12 #include "../../include/javascript/JS_Define.h"
13 #include "../../include/javascript/JS_Object.h" 13 #include "../../include/javascript/JS_Object.h"
14 #include "../../include/javascript/JS_Value.h" 14 #include "../../include/javascript/JS_Value.h"
15 #include "../../include/javascript/Document.h" 15 #include "../../include/javascript/Document.h"
16 #include "../../include/javascript/app.h" 16 #include "../../include/javascript/app.h"
17 #include "../../include/javascript/color.h" 17 #include "../../include/javascript/color.h"
18 #include "../../include/javascript/Consts.h" 18 #include "../../include/javascript/Consts.h"
19 #include "../../include/javascript/Document.h" 19 #include "../../include/javascript/Document.h"
20 #include "../../include/javascript/event.h" 20 #include "../../include/javascript/event.h"
21 #include "../../include/javascript/Field.h" 21 #include "../../include/javascript/Field.h"
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 29
30 #include <libplatform/libplatform.h>
31
30 CJS_RuntimeFactory::~CJS_RuntimeFactory() 32 CJS_RuntimeFactory::~CJS_RuntimeFactory()
31 { 33 {
32 } 34 }
33 35
34 IFXJS_Runtime* CJS_RuntimeFactory::NewJSRuntime (CPDFDoc_Environment* pApp) 36 IFXJS_Runtime* CJS_RuntimeFactory::NewJSRuntime (CPDFDoc_Environment* pApp)
35 { 37 {
36 if (!m_bInit) 38 if (!m_bInit)
37 { 39 {
38 JS_Initial(); 40 JS_Initial();
41 m_platform = v8::platform::CreateDefaultPlatform();
42 v8::V8::InitializePlatform(m_platform);
Lei Zhang 2014/08/01 06:51:22 With component builds on Linux, when loading PDFs
39 43
40 m_bInit = TRUE; 44 m_bInit = TRUE;
41 } 45 }
42 return new CJS_Runtime(pApp); 46 return new CJS_Runtime(pApp);
43 } 47 }
44 void CJS_RuntimeFactory::AddR ef() 48 void CJS_RuntimeFactory::AddR ef()
45 { 49 {
46 //to do.Should be implemented as atom manipulation. 50 //to do.Should be implemented as atom manipulation.
47 m_nRef++; 51 m_nRef++;
48 } 52 }
49 void CJS_RuntimeFactory::Rele ase() 53 void CJS_RuntimeFactory::Rele ase()
50 { 54 {
51 if(m_bInit) 55 if(m_bInit)
52 { 56 {
53 //to do.Should be implemented as atom manipulation. 57 //to do.Should be implemented as atom manipulation.
54 if (--m_nRef == 0) 58 if (--m_nRef == 0)
55 { 59 {
56 JS_Release(); 60 JS_Release();
57 ReleaseGlobalData(); 61 ReleaseGlobalData();
62 v8::V8::ShutdownPlatform();
63 delete m_platform;
64 m_platform = NULL;
58 m_bInit = FALSE; 65 m_bInit = FALSE;
59 } 66 }
60 } 67 }
61 } 68 }
62 69
63 void CJS_RuntimeFactory::Dele teJSRuntime(IFXJS_Runtime* pRuntime) 70 void CJS_RuntimeFactory::Dele teJSRuntime(IFXJS_Runtime* pRuntime)
64 { 71 {
65 if(pRuntime) 72 if(pRuntime)
66 delete (CJS_Runtime*)pRuntime; 73 delete (CJS_Runtime*)pRuntime;
67 } 74 }
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 return v8::Isolate::GetCurrent() == m_isolate; 468 return v8::Isolate::GetCurrent() == m_isolate;
462 } 469 }
463 void CJS_Runtime::Exit() 470 void CJS_Runtime::Exit()
464 { 471 {
465 if(m_isolate) m_isolate->Exit(); 472 if(m_isolate) m_isolate->Exit();
466 } 473 }
467 void CJS_Runtime::Enter() 474 void CJS_Runtime::Enter()
468 { 475 {
469 if(m_isolate) m_isolate->Enter(); 476 if(m_isolate) m_isolate->Enter();
470 } 477 }
OLDNEW
« no previous file with comments | « fpdfsdk/include/javascript/IJavaScript.h ('k') | pdfium.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698