summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_runtimedata.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-12-04 15:14:05 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-04 15:14:05 +0000
commit85caeb903c239d0c80aec86241885eabc1de71fb (patch)
tree43f1175aab8c758a722641005725ba41deba05c0 /fxjs/cfxjse_runtimedata.cpp
parent703b6f08a23a1e1d87c41266f92827ae28bf994d (diff)
downloadpdfium-85caeb903c239d0c80aec86241885eabc1de71fb.tar.xz
Remove unused XFA code
Change-Id: Iea75ce6b3a7e06b7977491a89e7a31755f038312 Reviewed-on: https://pdfium-review.googlesource.com/20191 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_runtimedata.cpp')
-rw-r--r--fxjs/cfxjse_runtimedata.cpp29
1 files changed, 4 insertions, 25 deletions
diff --git a/fxjs/cfxjse_runtimedata.cpp b/fxjs/cfxjse_runtimedata.cpp
index b8df9ce0b3..be6938e762 100644
--- a/fxjs/cfxjse_runtimedata.cpp
+++ b/fxjs/cfxjse_runtimedata.cpp
@@ -13,14 +13,6 @@
namespace {
-// Duplicates fpdfsdk's cjs_runtime.h, but keeps XFA from depending on it.
-// TODO(tsepez): make a single version of this.
-class FXJSE_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
- void* Allocate(size_t length) override { return calloc(1, length); }
- void* AllocateUninitialized(size_t length) override { return malloc(length); }
- void Free(void* data, size_t length) override { free(data); }
-};
-
void Runtime_DisposeCallback(v8::Isolate* pIsolate, bool bOwned) {
if (FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate))
delete pData;
@@ -55,23 +47,6 @@ void FXJSE_Finalize() {
CFXJSE_IsolateTracker::g_pInstance = nullptr;
}
-v8::Isolate* FXJSE_Runtime_Create_Own() {
- std::unique_ptr<v8::ArrayBuffer::Allocator> allocator(
- new FXJSE_ArrayBufferAllocator());
- v8::Isolate::CreateParams params;
- params.array_buffer_allocator = allocator.get();
- v8::Isolate* pIsolate = v8::Isolate::New(params);
- ASSERT(pIsolate && CFXJSE_IsolateTracker::g_pInstance);
- CFXJSE_IsolateTracker::g_pInstance->Append(pIsolate, std::move(allocator));
- return pIsolate;
-}
-
-void FXJSE_Runtime_Release(v8::Isolate* pIsolate) {
- if (!pIsolate)
- return;
- CFXJSE_IsolateTracker::g_pInstance->Remove(pIsolate, Runtime_DisposeCallback);
-}
-
CFXJSE_RuntimeData::CFXJSE_RuntimeData(v8::Isolate* pIsolate)
: m_pIsolate(pIsolate) {}
@@ -82,6 +57,7 @@ std::unique_ptr<CFXJSE_RuntimeData> CFXJSE_RuntimeData::Create(
std::unique_ptr<CFXJSE_RuntimeData> pRuntimeData(
new CFXJSE_RuntimeData(pIsolate));
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
+
v8::Local<v8::FunctionTemplate> hFuncTemplate =
v8::FunctionTemplate::New(pIsolate);
v8::Local<v8::ObjectTemplate> hGlobalTemplate =
@@ -90,9 +66,11 @@ std::unique_ptr<CFXJSE_RuntimeData> CFXJSE_RuntimeData::Create(
v8::Symbol::GetToStringTag(pIsolate),
v8::String::NewFromUtf8(pIsolate, "global", v8::NewStringType::kNormal)
.ToLocalChecked());
+
v8::Local<v8::Context> hContext =
v8::Context::New(pIsolate, 0, hGlobalTemplate);
hContext->SetSecurityToken(v8::External::New(pIsolate, pIsolate));
+
pRuntimeData->m_hRootContextGlobalTemplate.Reset(pIsolate, hFuncTemplate);
pRuntimeData->m_hRootContext.Reset(pIsolate, hContext);
return pRuntimeData;
@@ -100,6 +78,7 @@ std::unique_ptr<CFXJSE_RuntimeData> CFXJSE_RuntimeData::Create(
CFXJSE_RuntimeData* CFXJSE_RuntimeData::Get(v8::Isolate* pIsolate) {
FXJS_PerIsolateData::SetUp(pIsolate);
+
FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate);
if (!pData->m_pFXJSERuntimeData)
pData->m_pFXJSERuntimeData = CFXJSE_RuntimeData::Create(pIsolate);