diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-04-18 22:48:22 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-18 22:48:22 +0000 |
commit | a1fe73272892b668bd5928a836ecc6303c81e2fd (patch) | |
tree | 959f9576d3cfe49ad48f7a765bec64d7a954d3ff /fxjs/cjs_runtimestub.cpp | |
parent | fbecb9a5150d2c5391581933c8089e7249292171 (diff) | |
download | pdfium-a1fe73272892b668bd5928a836ecc6303c81e2fd.tar.xz |
Always build JS Runtime stubs even if V8 present.
Prerequisite for switching V8 off at run-time.
Change-Id: I4b9f867185758350f5de3f57e771f63020df6e65
Reviewed-on: https://pdfium-review.googlesource.com/30994
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cjs_runtimestub.cpp')
-rw-r--r-- | fxjs/cjs_runtimestub.cpp | 70 |
1 files changed, 25 insertions, 45 deletions
diff --git a/fxjs/cjs_runtimestub.cpp b/fxjs/cjs_runtimestub.cpp index 105bb6f114..98c7679a04 100644 --- a/fxjs/cjs_runtimestub.cpp +++ b/fxjs/cjs_runtimestub.cpp @@ -4,60 +4,40 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include <memory> +#include "fxjs/cjs_runtimestub.h" -#include "core/fxcrt/unowned_ptr.h" #include "fxjs/cjs_event_context_stub.h" -#include "fxjs/ijs_runtime.h" #include "third_party/base/ptr_util.h" -class CJS_RuntimeStub final : public IJS_Runtime { - public: - explicit CJS_RuntimeStub(CPDFSDK_FormFillEnvironment* pFormFillEnv) - : m_pFormFillEnv(pFormFillEnv) {} - ~CJS_RuntimeStub() override {} +CJS_RuntimeStub::CJS_RuntimeStub(CPDFSDK_FormFillEnvironment* pFormFillEnv) + : m_pFormFillEnv(pFormFillEnv) {} - IJS_EventContext* NewEventContext() override { - if (!m_pContext) - m_pContext = pdfium::MakeUnique<CJS_EventContextStub>(); - return m_pContext.get(); - } +CJS_RuntimeStub::~CJS_RuntimeStub() = default; - void ReleaseEventContext(IJS_EventContext* pContext) override {} - - CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override { - return m_pFormFillEnv.Get(); - } - -#ifdef PDF_ENABLE_XFA - bool GetValueByNameFromGlobalObject(const ByteStringView&, - CFXJSE_Value*) override { - return false; - } - - bool SetValueByNameInGlobalObject(const ByteStringView&, - CFXJSE_Value*) override { - return false; - } -#endif // PDF_ENABLE_XFA +IJS_EventContext* CJS_RuntimeStub::NewEventContext() { + if (!m_pContext) + m_pContext = pdfium::MakeUnique<CJS_EventContextStub>(); + return m_pContext.get(); +} - int ExecuteScript(const WideString& script, WideString* info) override { - return 0; - } +void CJS_RuntimeStub::ReleaseEventContext(IJS_EventContext* pContext) {} - protected: - UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv; - std::unique_ptr<CJS_EventContextStub> m_pContext; -}; +CPDFSDK_FormFillEnvironment* CJS_RuntimeStub::GetFormFillEnv() const { + return m_pFormFillEnv.Get(); +} -// static -void IJS_Runtime::Initialize(unsigned int slot, void* isolate) {} +#ifdef PDF_ENABLE_XFA +bool CJS_RuntimeStub::GetValueByNameFromGlobalObject(const ByteStringView&, + CFXJSE_Value*) { + return false; +} -// static -void IJS_Runtime::Destroy() {} +bool CJS_RuntimeStub::SetValueByNameInGlobalObject(const ByteStringView&, + CFXJSE_Value*) { + return false; +} +#endif // PDF_ENABLE_XFA -// static -std::unique_ptr<IJS_Runtime> IJS_Runtime::Create( - CPDFSDK_FormFillEnvironment* pFormFillEnv) { - return pdfium::MakeUnique<CJS_RuntimeStub>(pFormFillEnv); +int CJS_RuntimeStub::ExecuteScript(const WideString& script, WideString* info) { + return 0; } |