diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-07-16 11:09:12 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-07-16 11:09:12 -0700 |
commit | fb07e2843dad0774d5842c2b08e7792164efc14a (patch) | |
tree | 4583acca1bdcf5b60fad79af0b9fa405f192c5d8 /fpdfsdk/src/javascript/global.cpp | |
parent | cc8b4d8763151f51c9fe71ce9b64b2a0d7ddcc88 (diff) | |
download | pdfium-fb07e2843dad0774d5842c2b08e7792164efc14a.tar.xz |
Tidy up CPDFDOC_Environment.
- untabify as encountered.
- Only put single-statement method in .h file, move more
complex methods to .cpp (counting an if without braces as
a single statement, killing braces as needed).
- Move invariant arguments to constructor and make
corresponding members const.
- Make all members private and add accessor methods.
- Make existing accessor methods const where possible.
- Kill meaningless asserts.
- Add helper functions in place of duplicate code.
- Rename GetCurrentDoc() to GetSDKDocument(), since the class
has two document members, one of CPDF_Document and one of
CPDFSDK_Document, making it clear which one you get.
- Simplify some logic with early returns.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1235393002 .
Diffstat (limited to 'fpdfsdk/src/javascript/global.cpp')
-rw-r--r-- | fpdfsdk/src/javascript/global.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp index cddc919f75..6eea290f68 100644 --- a/fpdfsdk/src/javascript/global.cpp +++ b/fpdfsdk/src/javascript/global.cpp @@ -117,24 +117,14 @@ global_alternate::global_alternate(CJS_Object* pJSObject) global_alternate::~global_alternate(void) { - ASSERT(m_pApp != NULL); - -// CommitGlobalPersisitentVariables(); DestroyGlobalPersisitentVariables(); - - CJS_RuntimeFactory* pFactory = m_pApp->m_pJSRuntimeFactory; - ASSERT(pFactory); - - pFactory->ReleaseGlobalData(); + m_pApp->GetRuntimeFactory()->ReleaseGlobalData(); } void global_alternate::Initial(CPDFDoc_Environment* pApp) { m_pApp = pApp; - - CJS_RuntimeFactory* pFactory = pApp->m_pJSRuntimeFactory; - ASSERT(pFactory); - m_pGlobalData = pFactory->NewGlobalData(pApp); + m_pGlobalData = pApp->GetRuntimeFactory()->NewGlobalData(pApp); UpdateGlobalPersistentVariables(); } |