summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Runtime.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-09-14 14:32:33 -0700
committerTom Sepez <tsepez@chromium.org>2015-09-14 14:32:33 -0700
commit9a817f092e6800e9338b41acf4ea0416b6ad4467 (patch)
treec989a1abc1d24c108c7e8d869818368d373b1f00 /fpdfsdk/src/javascript/JS_Runtime.cpp
parentda0938f8671958aba0522a69fc687a7bbb01b435 (diff)
downloadpdfium-9a817f092e6800e9338b41acf4ea0416b6ad4467.tar.xz
Get CJS_RuntimeFactory out of the CJS_GlobalData management business.
First part of getting rid of CJS_RuntimeFactory. The factory design pattern isn't appropriate here since we only ever make one kind of object. CJS_GlobalData is now perfectly capable of managing itself through internal ref counts. I'm philosophically opposed to keeping ref-counts outside the object (do you hear me std::shared_ptr, you're bad!) R=thestig@chromium.org Review URL: https://codereview.chromium.org/1338993005 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Runtime.cpp')
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp20
1 files changed, 0 insertions, 20 deletions
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 4b18d80f6c..8ba7e81654 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -50,7 +50,6 @@ void CJS_RuntimeFactory::Release() {
// to do.Should be implemented as atom manipulation.
if (--m_nRef == 0) {
JS_Release();
- ReleaseGlobalData();
m_bInit = FALSE;
}
}
@@ -60,25 +59,6 @@ void CJS_RuntimeFactory::DeleteJSRuntime(IFXJS_Runtime* pRuntime) {
delete (CJS_Runtime*)pRuntime;
}
-CJS_GlobalData* CJS_RuntimeFactory::NewGlobalData(CPDFDoc_Environment* pApp) {
- if (m_pGlobalData) {
- m_nGlobalDataCount++;
- return m_pGlobalData;
- }
- m_nGlobalDataCount = 1;
- m_pGlobalData = new CJS_GlobalData(pApp);
- return m_pGlobalData;
-}
-
-void CJS_RuntimeFactory::ReleaseGlobalData() {
- m_nGlobalDataCount--;
-
- if (m_nGlobalDataCount <= 0) {
- delete m_pGlobalData;
- m_pGlobalData = NULL;
- }
-}
-
void* CJS_ArrayBufferAllocator::Allocate(size_t length) {
return calloc(1, length);
}