summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-01-16 14:59:26 -0800
committerTom Sepez <tsepez@chromium.org>2015-01-16 14:59:26 -0800
commit96d1334cb605aab143d3135da4d4550920735e91 (patch)
tree0a4371ef00759ce63cbb1324ef018b0311bcf84d /xfa
parenta7f7a284393dbadeb1aaa861677570b61b9658ae (diff)
downloadpdfium-96d1334cb605aab143d3135da4d4550920735e91.tar.xz
Merge to XFA: PDFium embeddertests.
This consists of two origin/master CLs: Review URL: https://codereview.chromium.org/857483005 Review URL: https://codereview.chromium.org/827733006 It also fixes a couple of segv's in XFA when the library is initialized and destroyed multiple times in the same process. R=jam@chromium.org TBR=jam@chromium.org Review URL: https://codereview.chromium.org/856623004
Diffstat (limited to 'xfa')
-rw-r--r--xfa/src/fwl/src/core/fwl_appimp.cpp2
-rw-r--r--xfa/src/fwl/src/core/fwl_noteimp.cpp19
-rw-r--r--xfa/src/fwl/src/core/include/fwl_noteimp.h9
-rw-r--r--xfa/src/fxjse/src/runtime.cpp10
4 files changed, 28 insertions, 12 deletions
diff --git a/xfa/src/fwl/src/core/fwl_appimp.cpp b/xfa/src/fwl/src/core/fwl_appimp.cpp
index 70e46e6a41..e70d3f6a09 100644
--- a/xfa/src/fwl/src/core/fwl_appimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_appimp.cpp
@@ -28,7 +28,7 @@ CFWL_AppImp::CFWL_AppImp(IFWL_AdapterNative *pAdapter)
}
CFWL_AppImp::~CFWL_AppImp()
{
- delete CFWL_ToolTipContainer::getInstance();
+ CFWL_ToolTipContainer::DeleteInstance();
if (m_bFuelAdapter) {
FWL_ReleaseFuelAdapterNative(m_pAdapterNative);
m_pAdapterNative = NULL;
diff --git a/xfa/src/fwl/src/core/fwl_noteimp.cpp b/xfa/src/fwl/src/core/fwl_noteimp.cpp
index 40f0c1137d..417020ac0f 100644
--- a/xfa/src/fwl/src/core/fwl_noteimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_noteimp.cpp
@@ -938,6 +938,9 @@ FX_BOOL CFWL_EventTarget::IsFilterEvent(CFWL_Event *pEvent, FX_DWORD dwFilter)
}
return bRet;
}
+
+CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = NULL;
+
CFWL_ToolTipContainer::CFWL_ToolTipContainer()
: pCurTarget(NULL)
, m_pToolTipImp(NULL)
@@ -959,13 +962,21 @@ CFWL_ToolTipContainer::~CFWL_ToolTipContainer()
m_ToolTipDp = NULL;
}
}
+// static
CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance()
{
- static CFWL_ToolTipContainer * _toolTipContainer = NULL;
- if (!_toolTipContainer) {
- _toolTipContainer = FX_NEW CFWL_ToolTipContainer;
+ if (!s_pInstance) {
+ s_pInstance = FX_NEW CFWL_ToolTipContainer;
+ }
+ return s_pInstance;
+}
+// static
+void CFWL_ToolTipContainer::DeleteInstance()
+{
+ if (s_pInstance) {
+ delete s_pInstance;
+ s_pInstance = NULL;
}
- return _toolTipContainer;
}
FX_ERR CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget *pTarget)
{
diff --git a/xfa/src/fwl/src/core/include/fwl_noteimp.h b/xfa/src/fwl/src/core/include/fwl_noteimp.h
index 1e7239289b..aeed0b3955 100644
--- a/xfa/src/fwl/src/core/include/fwl_noteimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_noteimp.h
@@ -127,8 +127,8 @@ protected:
class CFWL_ToolTipContainer: public CFX_Object
{
public:
- virtual ~CFWL_ToolTipContainer();
static CFWL_ToolTipContainer* getInstance();
+ static void DeleteInstance();
FX_ERR AddToolTipTarget(IFWL_ToolTipTarget *pTarget);
FX_ERR RemoveToolTipTarget(IFWL_ToolTipTarget *pTarget);
@@ -140,13 +140,18 @@ public:
FX_BOOL ProcessLeave(CFWL_EvtMouse *pEvt);
FX_ERR SetToolTipInitialDelay(FX_INT32 iDelayTime);
- FX_ERR SetToolTipAutoPopDelay(FX_INT32 iDelayTime);
+ FX_ERR SetToolTipAutoPopDelay(FX_INT32 iDelayTime);
+
protected:
CFWL_ToolTipContainer();
+ virtual ~CFWL_ToolTipContainer();
IFWL_ToolTipTarget *pCurTarget;
CFWL_ToolTipImp *m_pToolTipImp;
CFWL_CoreToopTipDP *m_ToolTipDp;
CFX_PtrArray m_arrWidget;
+
+private:
+ static CFWL_ToolTipContainer* s_pInstance;
};
#endif
diff --git a/xfa/src/fxjse/src/runtime.cpp b/xfa/src/fxjse/src/runtime.cpp
index e406f6a233..0a1b0db78b 100644
--- a/xfa/src/fxjse/src/runtime.cpp
+++ b/xfa/src/fxjse/src/runtime.cpp
@@ -14,6 +14,9 @@ static void FXJSE_KillV8()
}
void FXJSE_Initialize()
{
+ if(!CFXJSE_RuntimeData::g_RuntimeList) {
+ CFXJSE_RuntimeData::g_RuntimeList = FX_NEW CFXJSE_RuntimeList;
+ }
static FX_BOOL bV8Initialized = FALSE;
if (bV8Initialized) {
return;
@@ -26,12 +29,9 @@ void FXJSE_Initialize()
;
v8::V8::SetFlagsFromString(szCmdFlags, FXSYS_strlen(szCmdFlags));
v8::V8::InitializeICU();
- v8::Platform* platform = v8::platform::CreateDefaultPlatform();
- v8::V8::InitializePlatform(platform);
+ v8::Platform* platform = v8::platform::CreateDefaultPlatform();
+ v8::V8::InitializePlatform(platform);
v8::V8::Initialize();
- if(!CFXJSE_RuntimeData::g_RuntimeList) {
- CFXJSE_RuntimeData::g_RuntimeList = FX_NEW CFXJSE_RuntimeList;
- }
}
static void FXJSE_Runtime_DisposeCallback(v8::Isolate* pIsolate)
{