summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-18 12:32:20 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-18 20:16:06 +0000
commit940967de0b588d3abb9cba5822ae5f5c5fe05017 (patch)
tree6c34432c66d716918efd1917075076dbd870084a /fpdfsdk/javascript
parent690d456ad54f021063dcc17fde27c7ba4d910717 (diff)
downloadpdfium-940967de0b588d3abb9cba5822ae5f5c5fe05017.tar.xz
Use Unowned/Observed pointers between doc and FF onwership hierarchies.
See the explanation in CPDFSDK_FormFillEnvironment.h Change-Id: I52feb25fb358831233a636e3ead5aa70e98c5baa Reviewed-on: https://pdfium-review.googlesource.com/5658 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r--fpdfsdk/javascript/JS_Runtime_Stub.cpp5
-rw-r--r--fpdfsdk/javascript/cjs_event_context.h5
2 files changed, 6 insertions, 4 deletions
diff --git a/fpdfsdk/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
index dcd8ceb97c..73a38fcfa6 100644
--- a/fpdfsdk/javascript/JS_Runtime_Stub.cpp
+++ b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
@@ -6,6 +6,7 @@
#include <memory>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "fpdfsdk/javascript/ijs_event_context.h"
#include "fpdfsdk/javascript/ijs_runtime.h"
#include "third_party/base/ptr_util.h"
@@ -133,7 +134,7 @@ class CJS_RuntimeStub final : public IJS_Runtime {
void ReleaseEventContext(IJS_EventContext* pContext) override {}
CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override {
- return m_pFormFillEnv;
+ return m_pFormFillEnv.Get();
}
#ifdef PDF_ENABLE_XFA
@@ -152,7 +153,7 @@ class CJS_RuntimeStub final : public IJS_Runtime {
}
protected:
- CPDFSDK_FormFillEnvironment* m_pFormFillEnv;
+ CFX_UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
std::unique_ptr<CJS_EventContextStub> m_pContext;
};
diff --git a/fpdfsdk/javascript/cjs_event_context.h b/fpdfsdk/javascript/cjs_event_context.h
index 7bfe52816d..715bd9462b 100644
--- a/fpdfsdk/javascript/cjs_event_context.h
+++ b/fpdfsdk/javascript/cjs_event_context.h
@@ -9,6 +9,7 @@
#include <memory>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "fpdfsdk/javascript/ijs_event_context.h"
@@ -121,13 +122,13 @@ class CJS_EventContext : public IJS_EventContext {
void OnConsole_Exec() override;
void OnExternal_Exec() override;
- CJS_Runtime* GetJSRuntime() const { return m_pRuntime; }
+ CJS_Runtime* GetJSRuntime() const { return m_pRuntime.Get(); }
CJS_EventHandler* GetEventHandler() const { return m_pEventHandler.get(); }
CPDFSDK_FormFillEnvironment* GetFormFillEnv();
private:
- CJS_Runtime* const m_pRuntime;
+ CFX_UnownedPtr<CJS_Runtime> const m_pRuntime;
std::unique_ptr<CJS_EventHandler> m_pEventHandler;
bool m_bBusy;
};