Merge https://codereview.chromium.org/897973002/ and https://codereview.chromium...
authorJohn Abd-El-Malek <jam@chromium.org>
Tue, 10 Feb 2015 17:15:12 +0000 (09:15 -0800)
committerJohn Abd-El-Malek <jam@chromium.org>
Tue, 10 Feb 2015 17:15:12 +0000 (09:15 -0800)
R=jochen@chromium.org

Review URL: https://codereview.chromium.org/887073005

BUILD.gn
fpdfsdk/include/javascript/IJavaScript.h
fpdfsdk/src/javascript/JS_Runtime.cpp
pdfium.gyp
samples/BUILD.gn
samples/pdfium_test.cc
samples/samples.gyp
xfa/src/fxjse/src/runtime.cpp

index 0d26287..ff0ff97 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -815,9 +815,6 @@ static_library("javascript") {
   public_deps = [
     "//v8",
   ]
-  deps = [
-    "//v8:v8_libplatform",
-  ]
 }
 
 static_library("jsapi") {
index fbd89d2..9d50b04 100644 (file)
@@ -7,10 +7,6 @@
 #ifndef _IJAVASCRIPT_H_
 #define _IJAVASCRIPT_H_
 
-namespace v8 {
-class Platform;
-}
-
 class IFXJS_Context
 {
 public:
@@ -101,7 +97,7 @@ class CJS_GlobalData;
 class CJS_RuntimeFactory
 {
 public:
-       CJS_RuntimeFactory():m_bInit(FALSE),m_nRef(0),m_pGlobalData(NULL),m_nGlobalDataCount(0),m_platform(NULL) {}
+       CJS_RuntimeFactory():m_bInit(FALSE),m_nRef(0),m_pGlobalData(NULL),m_nGlobalDataCount(0) {}
        ~CJS_RuntimeFactory();
        IFXJS_Runtime*                                  NewJSRuntime(CPDFDoc_Environment* pApp);
        void                                                    DeleteJSRuntime(IFXJS_Runtime* pRuntime);
@@ -115,7 +111,6 @@ private:
        int m_nRef;
        CJS_GlobalData*                                 m_pGlobalData;
        FX_INT32                                                m_nGlobalDataCount;
-        v8::Platform*                                          m_platform;
 };
 
 #endif //_IJAVASCRIPT_H_
index cf06f9a..b0e80dd 100644 (file)
@@ -29,8 +29,6 @@
 #include "../../include/fpdfxfa/fpdfxfa_app.h"
 #include "../../../xfa/src/fxjse/src/value.h"
 
-#include <libplatform/libplatform.h>
-
 CJS_RuntimeFactory::~CJS_RuntimeFactory()
 {
 }
@@ -40,11 +38,6 @@ IFXJS_Runtime*                                       CJS_RuntimeFactory::NewJSRuntime(CPDFDoc_Environment* pApp)
        if (!m_bInit)
        {
                JS_Initial();
-/*
-                m_platform = v8::platform::CreateDefaultPlatform();
-                v8::V8::InitializePlatform(m_platform);
-                v8::V8::Initialize();
-*/
                m_bInit = TRUE;
        }
        return new CJS_Runtime(pApp);
@@ -63,9 +56,6 @@ void                                                  CJS_RuntimeFactory::Release()
                {
                        JS_Release();
                        ReleaseGlobalData();
-                        v8::V8::ShutdownPlatform();
-                        delete m_platform;
-                        m_platform = NULL;
                        m_bInit = FALSE;
                }
        }
index 65caf6f..d9c8ac2 100644 (file)
     {
       'target_name': 'javascript',
       'type': 'static_library',
-        'include_dirs': [
-          '<(DEPTH)/v8',
-          '<(DEPTH)/v8/include',
-        ],
+      'include_dirs': [
+        '<(DEPTH)/v8',
+        '<(DEPTH)/v8/include',
+      ],
       'dependencies': [
         '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
-        '<(DEPTH)/v8/tools/gyp/v8.gyp:v8_libplatform',
       ],
       'export_dependent_settings': [
         '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
index 7f2f41f..6bd2a81 100644 (file)
@@ -15,6 +15,11 @@ executable("pdfium_test") {
   ]
   deps = [
     "//third_party/pdfium",
+    "//v8:v8_libplatform",
+  ]
+  include_dirs = [
+    "//v8",
+    "//v8/include",
   ]
 }
 
@@ -27,4 +32,4 @@ executable("pdfium_diff") {
   deps = [
     "//third_party/pdfium",
   ]
-}
\ No newline at end of file
+}
index a813c9c..4f6e832 100644 (file)
 #include "../fpdfsdk/include/fpdftext.h"
 #include "../fpdfsdk/include/fpdfview.h"
 #include "../core/include/fxcrt/fx_system.h"
-#include "v8/include/v8.h"
 #include "image_diff_png.h"
+#include "v8/include/v8.h"
+#include "v8/include/libplatform/libplatform.h"
+
 
 #ifdef _WIN32
 #define snprintf _snprintf
@@ -573,6 +575,9 @@ int main(int argc, const char* argv[]) {
   }
 
   v8::V8::InitializeICU();
+  v8::Platform* platform = v8::platform::CreateDefaultPlatform();
+  v8::V8::InitializePlatform(platform);
+  v8::V8::Initialize();
 
 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
   v8::StartupData natives;
@@ -606,6 +611,8 @@ int main(int argc, const char* argv[]) {
   }
 
   FPDF_DestroyLibrary();
+  v8::V8::ShutdownPlatform();
+  delete platform;
 
   return 0;
 }
index e559790..c972142 100644 (file)
@@ -7,8 +7,13 @@
     'type': 'executable',
     'dependencies': [
       '../pdfium.gyp:pdfium',
+      '<(DEPTH)/v8/tools/gyp/v8.gyp:v8_libplatform',
+    ],
+    'include_dirs': [
+      '<(DEPTH)',
+      '<(DEPTH)/v8',
+      '<(DEPTH)/v8/include',
     ],
-    'include_dirs': ['<(DEPTH)'],
   },
   'targets': [
     {
index 0a1b0db..c4dc61c 100644 (file)
@@ -28,10 +28,6 @@ void FXJSE_Initialize()
         "--block_concurrent_recompilation "\r
         ;\r
     v8::V8::SetFlagsFromString(szCmdFlags, FXSYS_strlen(szCmdFlags));\r
-    v8::V8::InitializeICU();\r
-    v8::Platform* platform = v8::platform::CreateDefaultPlatform();\r
-    v8::V8::InitializePlatform(platform);\r
-    v8::V8::Initialize();\r
 }\r
 static void FXJSE_Runtime_DisposeCallback(v8::Isolate* pIsolate)\r
 {\r