Remove FX_LPCWSTR cast to wchar_t* literals
[pdfium.git] / fpdfsdk / src / javascript / JS_Runtime.cpp
index c7a92eb..52e3ae8 100644 (file)
@@ -27,6 +27,8 @@
 #include "../../include/javascript/global.h"
 #include "../../include/javascript/console.h"
 
+#include <libplatform/libplatform.h>
+
 CJS_RuntimeFactory::~CJS_RuntimeFactory()
 {
 }
@@ -36,6 +38,9 @@ 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;
        }
@@ -55,6 +60,9 @@ void                                                  CJS_RuntimeFactory::Release()
                {
                        JS_Release();
                        ReleaseGlobalData();
+                        v8::V8::ShutdownPlatform();
+                        delete m_platform;
+                        m_platform = NULL;
                        m_bInit = FALSE;
                }
        }
@@ -97,8 +105,8 @@ void CJS_RuntimeFactory::ReleaseGlobalData()
 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment * pApp) : 
        m_pApp(pApp),
        m_pDocument(NULL),
-       m_pFieldEventPath(NULL),
        m_bBlocking(FALSE),
+       m_pFieldEventPath(NULL),
        m_bRegistered(FALSE)
 {
        m_isolate = v8::Isolate::New();
@@ -322,7 +330,7 @@ v8::Handle<v8::Context>     CJS_Runtime::NewJSContext()
 CFX_WideString ChangeObjName(const CFX_WideString& str)
 {
        CFX_WideString sRet = str;
-       sRet.Replace((FX_LPCWSTR)L"_", (FX_LPCWSTR)L".");
+       sRet.Replace(L"_", L".");
        return sRet;
 }
 
@@ -341,7 +349,7 @@ void CJS_Runtime::GetObjectNames(CFX_WideStringArray& array)
        array.Add(CJS_Zoomtype::m_pClassName);
 
        array.Add(CJS_App::m_pClassName);
-       array.Add((FX_LPCWSTR)"this"); 
+       array.Add(L"this");
        array.Add(CJS_Event::m_pClassName);     
 
        array.Add(CJS_Global::m_pClassName);