summaryrefslogtreecommitdiffstats
path: root/WebCore/bridge/runtime.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-10-08 17:19:54 +0100
committerSteve Block <steveblock@google.com>2009-10-20 00:41:58 +0100
commit231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch)
treea6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebCore/bridge/runtime.cpp
parente196732677050bd463301566a68a643b6d14b907 (diff)
downloadexternal_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebCore/bridge/runtime.cpp')
-rw-r--r--WebCore/bridge/runtime.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/WebCore/bridge/runtime.cpp b/WebCore/bridge/runtime.cpp
index 6934406..eac8586 100644
--- a/WebCore/bridge/runtime.cpp
+++ b/WebCore/bridge/runtime.cpp
@@ -48,12 +48,14 @@ Array::~Array()
Instance::Instance(PassRefPtr<RootObject> rootObject)
: _rootObject(rootObject)
+ , m_runtimeObject(0)
{
ASSERT(_rootObject);
}
Instance::~Instance()
{
+ ASSERT(!m_runtimeObject);
}
static KJSDidExecuteFunctionPtr s_didExecuteFunction;
@@ -80,11 +82,37 @@ void Instance::end()
RuntimeObjectImp* Instance::createRuntimeObject(ExecState* exec)
{
+ ASSERT(_rootObject);
+ ASSERT(_rootObject->isValid());
+ if (m_runtimeObject)
+ return m_runtimeObject;
+ JSLock lock(SilenceAssertionsOnly);
+ m_runtimeObject = newRuntimeObject(exec);
+ _rootObject->addRuntimeObject(m_runtimeObject);
+ return m_runtimeObject;
+}
+
+RuntimeObjectImp* Instance::newRuntimeObject(ExecState* exec)
+{
JSLock lock(SilenceAssertionsOnly);
-
return new (exec) RuntimeObjectImp(exec, this);
}
+void Instance::willDestroyRuntimeObject()
+{
+ ASSERT(_rootObject);
+ ASSERT(_rootObject->isValid());
+ ASSERT(m_runtimeObject);
+ _rootObject->removeRuntimeObject(m_runtimeObject);
+ m_runtimeObject = 0;
+}
+
+void Instance::willInvalidateRuntimeObject()
+{
+ ASSERT(m_runtimeObject);
+ m_runtimeObject = 0;
+}
+
RootObject* Instance::rootObject() const
{
return _rootObject && _rootObject->isValid() ? _rootObject.get() : 0;