https://bugs.webkit.org/show_bug.cgi?id=109268
Patch by Dan Carney <dcarney@google.com> on 2013-02-08
Reviewed by Kentaro Hara.
Source/WebCore:
No new tests. No change in functionality.
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateDomainSafeFunctionGetter):
(GenerateNamedConstructorCallback):
(GenerateImplementation):
* bindings/scripts/test/V8/V8Float64Array.cpp:
(WebCore::V8Float64Array::GetRawTemplate):
* bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:
(WebCore::TestActiveDOMObjectV8Internal::postMessageAttrGetter):
(WebCore::V8TestActiveDOMObject::GetRawTemplate):
* bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:
(WebCore::V8TestCustomNamedGetter::GetRawTemplate):
* bindings/scripts/test/V8/V8TestEventConstructor.cpp:
(WebCore::V8TestEventConstructor::GetRawTemplate):
* bindings/scripts/test/V8/V8TestEventTarget.cpp:
(WebCore::V8TestEventTarget::GetRawTemplate):
* bindings/scripts/test/V8/V8TestException.cpp:
(WebCore::V8TestException::GetRawTemplate):
* bindings/scripts/test/V8/V8TestInterface.cpp:
(WebCore::V8TestInterface::GetRawTemplate):
* bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
(WebCore::V8TestMediaQueryListListener::GetRawTemplate):
* bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
(WebCore::V8TestNamedConstructorConstructor::GetTemplate):
(WebCore::V8TestNamedConstructor::GetRawTemplate):
* bindings/scripts/test/V8/V8TestNode.cpp:
(WebCore::V8TestNode::GetRawTemplate):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::V8TestObj::GetRawTemplate):
* bindings/scripts/test/V8/V8TestOverloadedConstructors.cpp:
(WebCore::V8TestOverloadedConstructors::GetRawTemplate):
* bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
(WebCore::V8TestSerializedScriptValueInterface::GetRawTemplate):
* bindings/v8/DOMWrapperMap.h:
(WebCore::DOMWrapperMap::clear):
* bindings/v8/DOMWrapperWorld.cpp:
(WebCore::isolatedWorldWeakCallback):
(WebCore::DOMWrapperWorld::makeContextWeak):
* bindings/v8/NPV8Object.cpp:
(WebCore::freeV8NPObject):
(WebCore::npCreateV8ScriptObject):
* bindings/v8/ScheduledAction.cpp:
(WebCore::ScheduledAction::ScheduledAction):
(WebCore::ScheduledAction::~ScheduledAction):
* bindings/v8/ScopedPersistent.h:
(WebCore::ScopedPersistent::ScopedPersistent):
(WebCore::ScopedPersistent::set):
(WebCore::ScopedPersistent::clear):
* bindings/v8/ScriptWrappable.h:
(WebCore::ScriptWrappable::setWrapper):
(WebCore::ScriptWrappable::disposeWrapper):
(WebCore::ScriptWrappable::weakCallback):
* bindings/v8/V8Binding.cpp:
(WebCore::createRawTemplate):
* bindings/v8/V8Binding.h:
(WebCore):
* bindings/v8/V8GCController.cpp:
(WebCore::gcTree):
(WebCore::V8GCController::gcPrologue):
(WebCore::V8GCController::minorGCPrologue):
* bindings/v8/V8GCController.h:
(V8GCController):
* bindings/v8/V8HiddenPropertyName.cpp:
(WebCore::V8HiddenPropertyName::createString):
* bindings/v8/V8LazyEventListener.cpp:
(WebCore::V8LazyEventListener::prepareListenerObject):
* bindings/v8/V8NPObject.cpp:
(WebCore::V8NPTemplateMap::dispose):
(WebCore::npObjectGetProperty):
(WebCore::createV8ObjectForNPObject):
* bindings/v8/V8PerContextData.cpp:
(WebCore::V8PerContextData::dispose):
(WebCore::V8PerContextData::createWrapperFromCacheSlowCase):
(WebCore::V8PerContextData::constructorForTypeSlowCase):
* bindings/v8/V8ValueCache.cpp:
(WebCore::makeExternalString):
* bindings/v8/WrapperTypeInfo.h:
(WebCore::WrapperConfiguration::configureWrapper):
* bindings/v8/custom/V8HTMLDocumentCustom.cpp:
(WebCore::V8HTMLDocument::wrapInShadowObject):
* bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
(WebCore::V8HTMLImageElementConstructor::GetTemplate):
* bindings/v8/custom/V8InjectedScriptManager.cpp:
(WebCore::WeakReferenceCallback):
(WebCore::createInjectedScriptHostV8Wrapper):
* bindings/v8/custom/V8LocationCustom.cpp:
(WebCore::V8Location::reloadAccessorGetter):
(WebCore::V8Location::replaceAccessorGetter):
(WebCore::V8Location::assignAccessorGetter):
Source/WebKit/chromium:
* tests/WebFrameTest.cpp:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142250
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-02-08 Dan Carney <dcarney@google.com>
+
+ [v8] isolate parameter added to all v8::peristent calls
+ https://bugs.webkit.org/show_bug.cgi?id=109268
+
+ Reviewed by Kentaro Hara.
+
+ No new tests. No change in functionality.
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (GenerateDomainSafeFunctionGetter):
+ (GenerateNamedConstructorCallback):
+ (GenerateImplementation):
+ * bindings/scripts/test/V8/V8Float64Array.cpp:
+ (WebCore::V8Float64Array::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:
+ (WebCore::TestActiveDOMObjectV8Internal::postMessageAttrGetter):
+ (WebCore::V8TestActiveDOMObject::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:
+ (WebCore::V8TestCustomNamedGetter::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestEventConstructor.cpp:
+ (WebCore::V8TestEventConstructor::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestEventTarget.cpp:
+ (WebCore::V8TestEventTarget::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestException.cpp:
+ (WebCore::V8TestException::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestInterface.cpp:
+ (WebCore::V8TestInterface::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
+ (WebCore::V8TestMediaQueryListListener::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
+ (WebCore::V8TestNamedConstructorConstructor::GetTemplate):
+ (WebCore::V8TestNamedConstructor::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestNode.cpp:
+ (WebCore::V8TestNode::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::V8TestObj::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestOverloadedConstructors.cpp:
+ (WebCore::V8TestOverloadedConstructors::GetRawTemplate):
+ * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
+ (WebCore::V8TestSerializedScriptValueInterface::GetRawTemplate):
+ * bindings/v8/DOMWrapperMap.h:
+ (WebCore::DOMWrapperMap::clear):
+ * bindings/v8/DOMWrapperWorld.cpp:
+ (WebCore::isolatedWorldWeakCallback):
+ (WebCore::DOMWrapperWorld::makeContextWeak):
+ * bindings/v8/NPV8Object.cpp:
+ (WebCore::freeV8NPObject):
+ (WebCore::npCreateV8ScriptObject):
+ * bindings/v8/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::ScheduledAction):
+ (WebCore::ScheduledAction::~ScheduledAction):
+ * bindings/v8/ScopedPersistent.h:
+ (WebCore::ScopedPersistent::ScopedPersistent):
+ (WebCore::ScopedPersistent::set):
+ (WebCore::ScopedPersistent::clear):
+ * bindings/v8/ScriptWrappable.h:
+ (WebCore::ScriptWrappable::setWrapper):
+ (WebCore::ScriptWrappable::disposeWrapper):
+ (WebCore::ScriptWrappable::weakCallback):
+ * bindings/v8/V8Binding.cpp:
+ (WebCore::createRawTemplate):
+ * bindings/v8/V8Binding.h:
+ (WebCore):
+ * bindings/v8/V8GCController.cpp:
+ (WebCore::gcTree):
+ (WebCore::V8GCController::gcPrologue):
+ (WebCore::V8GCController::minorGCPrologue):
+ * bindings/v8/V8GCController.h:
+ (V8GCController):
+ * bindings/v8/V8HiddenPropertyName.cpp:
+ (WebCore::V8HiddenPropertyName::createString):
+ * bindings/v8/V8LazyEventListener.cpp:
+ (WebCore::V8LazyEventListener::prepareListenerObject):
+ * bindings/v8/V8NPObject.cpp:
+ (WebCore::V8NPTemplateMap::dispose):
+ (WebCore::npObjectGetProperty):
+ (WebCore::createV8ObjectForNPObject):
+ * bindings/v8/V8PerContextData.cpp:
+ (WebCore::V8PerContextData::dispose):
+ (WebCore::V8PerContextData::createWrapperFromCacheSlowCase):
+ (WebCore::V8PerContextData::constructorForTypeSlowCase):
+ * bindings/v8/V8ValueCache.cpp:
+ (WebCore::makeExternalString):
+ * bindings/v8/WrapperTypeInfo.h:
+ (WebCore::WrapperConfiguration::configureWrapper):
+ * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
+ (WebCore::V8HTMLDocument::wrapInShadowObject):
+ * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
+ (WebCore::V8HTMLImageElementConstructor::GetTemplate):
+ * bindings/v8/custom/V8InjectedScriptManager.cpp:
+ (WebCore::WeakReferenceCallback):
+ (WebCore::createInjectedScriptHostV8Wrapper):
+ * bindings/v8/custom/V8LocationCustom.cpp:
+ (WebCore::V8Location::reloadAccessorGetter):
+ (WebCore::V8Location::replaceAccessorGetter):
+ (WebCore::V8Location::assignAccessorGetter):
+
2013-02-08 Kent Tamura <tkent@chromium.org>
Adjust usage of ENABLE flags to enable whole content
push(@implContentDecls, <<END);
static v8::Handle<v8::Value> ${funcName}AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New($newTemplateString);
+ static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(info.GetIsolate(), $newTemplateString);
v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(${v8InterfaceName}::GetTemplate(info.GetIsolate()));
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
}
${interfaceName}* imp = ${v8InterfaceName}::toNative(holder);
if (!BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), imp->frame(), DoNotReportSecurityError)) {
- static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New($newTemplateString);
+ static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(info.GetIsolate(), $newTemplateString);
return sharedTemplate->GetFunction();
}
result->SetClassName(v8::String::NewSymbol("${interfaceName}"));
result->Inherit(${v8InterfaceName}::GetTemplate(isolate));
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
+ cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, result);
return cachedTemplate;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
{
static v8::Persistent<v8::ObjectTemplate> V8DOMWindowShadowObjectCache;
if (V8DOMWindowShadowObjectCache.IsEmpty()) {
- V8DOMWindowShadowObjectCache = v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New());
+ V8DOMWindowShadowObjectCache = v8::Persistent<v8::ObjectTemplate>::New(isolate, v8::ObjectTemplate::New());
ConfigureShadowObjectTemplate(V8DOMWindowShadowObjectCache, isolate);
}
return V8DOMWindowShadowObjectCache;
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
static v8::Handle<v8::Value> postMessageAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(TestActiveDOMObjectV8Internal::postMessageCallback, v8Undefined(), v8::Signature::New(V8TestActiveDOMObject::GetRawTemplate(info.GetIsolate()))));
+ static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(info.GetIsolate(), v8::FunctionTemplate::New(TestActiveDOMObjectV8Internal::postMessageCallback, v8Undefined(), v8::Signature::New(V8TestActiveDOMObject::GetRawTemplate(info.GetIsolate()))));
v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8TestActiveDOMObject::GetTemplate(info.GetIsolate()));
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
}
TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(holder);
if (!BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), imp->frame(), DoNotReportSecurityError)) {
- static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(TestActiveDOMObjectV8Internal::postMessageCallback, v8Undefined(), v8::Signature::New(V8TestActiveDOMObject::GetRawTemplate(info.GetIsolate()))));
+ static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(info.GetIsolate(), v8::FunctionTemplate::New(TestActiveDOMObjectV8Internal::postMessageCallback, v8Undefined(), v8::Signature::New(V8TestActiveDOMObject::GetRawTemplate(info.GetIsolate()))));
return sharedTemplate->GetFunction();
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
result->SetClassName(v8::String::NewSymbol("TestNamedConstructor"));
result->Inherit(V8TestNamedConstructor::GetTemplate(isolate));
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
+ cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, result);
return cachedTemplate;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
return result->value;
v8::HandleScope handleScope;
- v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate(isolate);
data->rawTemplateMap().add(&info, templ);
return templ;
}
for (typename MapType::iterator it = m_map.begin(); it != m_map.end(); ++it) {
v8::Persistent<v8::Object> wrapper = it->value;
toWrapperTypeInfo(wrapper)->derefObject(it->key);
- wrapper.Dispose();
+ wrapper.Dispose(m_isolate);
wrapper.Clear();
}
m_map.clear();
static void isolatedWorldWeakCallback(v8::Isolate* isolate, v8::Persistent<v8::Value> object, void* parameter)
{
- object.Dispose();
+ object.Dispose(isolate);
object.Clear();
static_cast<DOMWrapperWorld*>(parameter)->deref();
}
{
ASSERT(isIsolatedWorld());
ASSERT(isolated(context) == this);
- v8::Persistent<v8::Context>::New(context).MakeWeak(context->GetIsolate(), this, isolatedWorldWeakCallback);
+ v8::Isolate* isolate = context->GetIsolate();
+ v8::Persistent<v8::Context>::New(isolate, context).MakeWeak(isolate, this, isolatedWorldWeakCallback);
// Matching deref is in weak callback.
this->ref();
}
v8NPObjectMap->remove(v8ObjectHash);
}
}
- v8NpObject->v8Object.Dispose();
+ v8NpObject->v8Object.Dispose(v8::Isolate::GetCurrent());
v8NpObject->v8Object.Clear();
free(v8NpObject);
}
objectVector = &iter->value;
}
V8NPObject* v8npObject = reinterpret_cast<V8NPObject*>(_NPN_CreateObject(npp, &V8NPObjectClass));
- v8npObject->v8Object = v8::Persistent<v8::Object>::New(object);
+ v8npObject->v8Object = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), object);
v8npObject->rootObject = root;
if (objectVector)
, m_function(function)
, m_code(String(), KURL(), TextPosition::belowRangePosition())
{
+ v8::Isolate* isolate = m_context->GetIsolate();
m_args.reserveCapacity(argc);
for (int i = 0; i < argc; ++i)
- m_args.append(v8::Persistent<v8::Value>::New(argv[i]));
+ m_args.append(v8::Persistent<v8::Value>::New(isolate, argv[i]));
}
ScheduledAction::~ScheduledAction()
{
for (size_t i = 0; i < m_args.size(); ++i) {
- m_args[i].Dispose();
+ m_args[i].Dispose(m_context->GetIsolate());
m_args[i].Clear();
}
}
ScopedPersistent() { }
explicit ScopedPersistent(v8::Handle<T> handle)
- : m_handle(v8::Persistent<T>::New(handle))
+ : m_handle(v8::Persistent<T>::New(v8::Isolate::GetCurrent(), handle))
{
}
void set(v8::Handle<T> handle)
{
clear();
- m_handle = v8::Persistent<T>::New(handle);
+ m_handle = v8::Persistent<T>::New(v8::Isolate::GetCurrent(), handle);
}
void adopt(v8::Persistent<T> handle)
{
if (m_handle.IsEmpty())
return;
- m_handle.Dispose();
+ m_handle.Dispose(v8::Isolate::GetCurrent());
m_handle.Clear();
}
void setWrapper(v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const WrapperConfiguration& configuration)
{
ASSERT(m_maskedWrapper.IsEmpty());
- v8::Persistent<v8::Object> persistent = v8::Persistent<v8::Object>::New(wrapper);
+ v8::Persistent<v8::Object> persistent = v8::Persistent<v8::Object>::New(isolate, wrapper);
configuration.configureWrapper(persistent, isolate);
persistent.MakeWeak(isolate, this, weakCallback);
m_maskedWrapper = maskOrUnmaskPointer(*persistent);
}
private:
- inline void disposeWrapper(v8::Persistent<v8::Value> value)
+ inline void disposeWrapper(v8::Persistent<v8::Value> value, v8::Isolate* isolate)
{
ASSERT(!m_maskedWrapper.IsEmpty());
ASSERT(*value == maskOrUnmaskPointer(*m_maskedWrapper));
- value.Dispose();
+ value.Dispose(isolate);
m_maskedWrapper.Clear();
}
ASSERT(value->IsObject());
v8::Persistent<v8::Object> wrapper = v8::Persistent<v8::Object>::Cast(value);
ASSERT(key->wrapper() == wrapper);
- key->disposeWrapper(value);
+ key->disposeWrapper(value, isolate);
// Note: |object| might not be equal to |key|, e.g., if ScriptWrappable isn't a left-most base class.
void* object = toNative(wrapper);
return uintValue->Value();
}
-v8::Persistent<v8::FunctionTemplate> createRawTemplate()
+v8::Persistent<v8::FunctionTemplate> createRawTemplate(v8::Isolate* isolate)
{
v8::HandleScope scope;
v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(V8ObjectConstructor::isValidConstructorMode);
- return v8::Persistent<v8::FunctionTemplate>::New(result);
+ return v8::Persistent<v8::FunctionTemplate>::New(isolate, result);
}
PassRefPtr<DOMStringList> toDOMStringList(v8::Handle<v8::Value> value, v8::Isolate* isolate)
return isfinite(value) ? v8::Date::New(value) : v8NullWithCheck(isolate);
}
- v8::Persistent<v8::FunctionTemplate> createRawTemplate();
+ v8::Persistent<v8::FunctionTemplate> createRawTemplate(v8::Isolate*);
PassRefPtr<DOMStringList> toDOMStringList(v8::Handle<v8::Value>, v8::Isolate*);
PassRefPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value>, v8::Isolate*);
ASSERT(V8DOMWrapper::maybeDOMWrapper(value));
- if (value.IsIndependent())
+ if (value.IsIndependent(m_isolate))
return;
WrapperTypeInfo* type = toWrapperTypeInfo(wrapper);
if (classId == v8DOMNodeClassId) {
UNUSED_PARAM(m_isolate);
ASSERT(V8Node::HasInstance(wrapper, m_isolate));
- ASSERT(!wrapper.IsIndependent());
+ ASSERT(!wrapper.IsIndependent(m_isolate));
Node* node = static_cast<Node*>(object);
// m_edenNodes stores nodes that have wrappers that have been created since the last minor/major GC.
Vector<Node*>* V8GCController::m_edenNodes = 0;
-static void gcTree(Node* startNode)
+static void gcTree(v8::Isolate* isolate, Node* startNode)
{
Vector<v8::Persistent<v8::Value>, initialNodeVectorSize> newSpaceWrappers;
// stored in newSpaceWrappers and are expected to exist in the new space of V8.
// We report those wrappers to V8 as an object group.
for (size_t i = 0; i < newSpaceWrappers.size(); i++)
- newSpaceWrappers[i].MarkPartiallyDependent();
+ newSpaceWrappers[i].MarkPartiallyDependent(isolate);
if (newSpaceWrappers.size() > 0)
v8::V8::AddObjectGroup(&newSpaceWrappers[0], newSpaceWrappers.size());
}
void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags)
{
+ // It would be nice if the GC callbacks passed the Isolate directly....
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
if (type == v8::kGCTypeScavenge)
- minorGCPrologue();
+ minorGCPrologue(isolate);
else if (type == v8::kGCTypeMarkSweepCompact)
majorGCPrologue();
}
}
-void V8GCController::minorGCPrologue()
+void V8GCController::minorGCPrologue(v8::Isolate* isolate)
{
TRACE_EVENT_BEGIN0("v8", "GC");
for (size_t i = 0; i < m_edenNodes->size(); i++) {
ASSERT(!m_edenNodes->at(i)->wrapper().IsEmpty());
if (m_edenNodes->at(i)->isV8CollectableDuringMinorGC()) // This branch is just for performance.
- gcTree(m_edenNodes->at(i));
+ gcTree(isolate, m_edenNodes->at(i));
}
}
}
public:
static void gcPrologue(v8::GCType, v8::GCCallbackFlags);
static void gcEpilogue(v8::GCType, v8::GCCallbackFlags);
- static void minorGCPrologue();
+ static void minorGCPrologue(v8::Isolate*);
static void minorGCEpilogue();
static void majorGCPrologue();
static void majorGCEpilogue();
v8::Persistent<v8::String> V8HiddenPropertyName::createString(const char* key)
{
v8::HandleScope scope;
- return v8::Persistent<v8::String>::New(v8::String::NewSymbol(key));
+ return v8::Persistent<v8::String>::New(v8::Isolate::GetCurrent(), v8::String::NewSymbol(key));
}
} // namespace WebCore
v8::Persistent<v8::FunctionTemplate>& toStringTemplate =
V8PerIsolateData::current()->lazyEventListenerToStringTemplate();
if (toStringTemplate.IsEmpty())
- toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8LazyEventListenerToString));
+ toStringTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New(V8LazyEventListenerToString));
v8::Local<v8::Function> toStringFunction;
if (!toStringTemplate.IsEmpty())
toStringFunction = toStringTemplate->GetFunction();
{
MapType::iterator it = m_map.find(key);
ASSERT(it != m_map.end());
- it->value.Dispose();
+ it->value.Dispose(m_isolate);
it->value.Clear();
m_map.remove(it);
}
// Create a new template.
v8::Local<v8::FunctionTemplate> temp = v8::FunctionTemplate::New();
temp->SetCallHandler(npObjectMethodHandler, key);
- functionTemplate = v8::Persistent<v8::FunctionTemplate>::New(temp);
+ functionTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, temp);
V8NPTemplateMap::sharedInstance(isolate).set(id, functionTemplate);
}
// FIXME: we should create a Wrapper type as a subclass of JSObject. It has two internal fields, field 0 is the wrapped
// pointer, and field 1 is the type. There should be an api function that returns unused type id. The same Wrapper type
// can be used by DOM bindings.
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
if (npObjectDesc.IsEmpty()) {
- npObjectDesc = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
+ npObjectDesc = v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New());
npObjectDesc->InstanceTemplate()->SetInternalFieldCount(npObjectInternalFieldCount);
npObjectDesc->InstanceTemplate()->SetNamedPropertyHandler(npObjectNamedPropertyGetter, npObjectNamedPropertySetter, npObjectQueryProperty, 0, npObjectNamedPropertyEnumerator);
npObjectDesc->InstanceTemplate()->SetIndexedPropertyHandler(npObjectIndexedPropertyGetter, npObjectIndexedPropertySetter, 0, 0, npObjectIndexedPropertyEnumerator);
void V8PerContextData::dispose()
{
v8::HandleScope handleScope;
+ v8::Isolate* isolate = m_context->GetIsolate();
m_context->SetAlignedPointerInEmbedderData(v8ContextPerContextDataIndex, 0);
{
WrapperBoilerplateMap::iterator it = m_wrapperBoilerplates.begin();
for (; it != m_wrapperBoilerplates.end(); ++it) {
v8::Persistent<v8::Object> wrapper = it->value;
- wrapper.Dispose();
+ wrapper.Dispose(isolate);
wrapper.Clear();
}
m_wrapperBoilerplates.clear();
ConstructorMap::iterator it = m_constructorMap.begin();
for (; it != m_constructorMap.end(); ++it) {
v8::Persistent<v8::Function> wrapper = it->value;
- wrapper.Dispose();
+ wrapper.Dispose(isolate);
wrapper.Clear();
}
m_constructorMap.clear();
v8::Local<v8::Function> function = constructorForType(type);
v8::Local<v8::Object> instance = V8ObjectConstructor::newInstance(function);
if (!instance.IsEmpty()) {
- m_wrapperBoilerplates.set(type, v8::Persistent<v8::Object>::New(instance));
+ m_wrapperBoilerplates.set(type, v8::Persistent<v8::Object>::New(m_context->GetIsolate(), instance));
return instance->Clone();
}
return v8::Local<v8::Object>();
prototypeObject->SetPrototype(m_errorPrototype.get());
}
- m_constructorMap.set(type, v8::Persistent<v8::Function>::New(function));
+ m_constructorMap.set(type, v8::Persistent<v8::Function>::New(m_context->GetIsolate(), function));
return function;
}
{
StringImpl* stringImpl = static_cast<StringImpl*>(parameter);
V8PerIsolateData::current()->stringCache()->remove(stringImpl);
- wrapper.Dispose();
+ wrapper.Dispose(isolate);
wrapper.Clear();
stringImpl->deref();
}
return v8::String::Empty(isolate);
v8::Persistent<v8::String> cachedV8String = m_stringCache.get(stringImpl);
- if (cachedV8String.IsWeak()) {
+ if (cachedV8String.IsWeak(isolate)) {
m_lastStringImpl = stringImpl;
m_lastV8String = cachedV8String;
if (handleType == ReturnUnsafeHandle)
if (newString.IsEmpty())
return newString;
- v8::Persistent<v8::String> wrapper = v8::Persistent<v8::String>::New(newString);
+ v8::Persistent<v8::String> wrapper = v8::Persistent<v8::String>::New(isolate, newString);
if (wrapper.IsEmpty())
return newString;
stringImpl->ref();
- wrapper.MarkIndependent();
+ wrapper.MarkIndependent(isolate);
wrapper.MakeWeak(isolate, stringImpl, cachedStringCallback);
m_stringCache.set(stringImpl, wrapper);
void configureWrapper(v8::Persistent<v8::Object> wrapper, v8::Isolate* isolate) const
{
- wrapper.SetWrapperClassId(classId);
+ wrapper.SetWrapperClassId(isolate, classId);
if (lifetime == Independent)
wrapper.MarkIndependent(isolate);
}
{
DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, shadowTemplate, ());
if (shadowTemplate.IsEmpty()) {
- shadowTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
+ shadowTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New());
if (shadowTemplate.IsEmpty())
return v8::Local<v8::Object>();
shadowTemplate->SetClassName(v8::String::NewSymbol("HTMLDocument"));
result->SetClassName(v8::String::NewSymbol("HTMLImageElement"));
result->Inherit(V8HTMLImageElement::GetTemplate(isolate));
- cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
+ cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, result);
return cachedTemplate;
}
{
InjectedScriptHost* nativeObject = static_cast<InjectedScriptHost*>(parameter);
nativeObject->deref();
- object.Dispose();
+ object.Dispose(isolate);
object.Clear();
}
// Create a weak reference to the v8 wrapper of InspectorBackend to deref
// InspectorBackend when the wrapper is garbage collected.
host->ref();
- v8::Persistent<v8::Object> weakHandle = v8::Persistent<v8::Object>::New(instance);
+ v8::Persistent<v8::Object> weakHandle = v8::Persistent<v8::Object>::New(isolate, instance);
weakHandle.MakeWeak(isolate, host, &WeakReferenceCallback);
return instance;
}
v8::Handle<v8::Value> V8Location::reloadAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::reloadCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(info.GetIsolate()))));
- v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8Location::GetTemplate(info.GetIsolate()));
+ v8::Isolate* isolate = info.GetIsolate();
+ static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New(V8Location::reloadCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(isolate))));
+ v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8Location::GetTemplate(isolate));
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
}
Location* imp = V8Location::toNative(holder);
if (!BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), imp->frame(), DoNotReportSecurityError)) {
- static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::reloadCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(info.GetIsolate()))));
+ static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New(V8Location::reloadCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(isolate))));
return sharedTemplate->GetFunction();
}
return privateTemplate->GetFunction();
v8::Handle<v8::Value> V8Location::replaceAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::replaceCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(info.GetIsolate()))));
- v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8Location::GetTemplate(info.GetIsolate()));
+ v8::Isolate* isolate = info.GetIsolate();
+ static v8::Persistent<v8::FunctionTemplate> privateTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New(V8Location::replaceCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(isolate))));
+ v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8Location::GetTemplate(isolate));
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
}
Location* imp = V8Location::toNative(holder);
if (!BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), imp->frame(), DoNotReportSecurityError)) {
- static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::replaceCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(info.GetIsolate()))));
+ static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New(V8Location::replaceCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(isolate))));
return sharedTemplate->GetFunction();
}
return privateTemplate->GetFunction();
v8::Handle<v8::Value> V8Location::assignAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
+ v8::Isolate* isolate = info.GetIsolate();
static v8::Persistent<v8::FunctionTemplate> privateTemplate =
- v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::assignCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(info.GetIsolate()))));
- v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8Location::GetTemplate(info.GetIsolate()));
+ v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New(V8Location::assignCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(isolate))));
+ v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8Location::GetTemplate(isolate));
if (holder.IsEmpty()) {
// can only reach here by 'object.__proto__.func', and it should passed
// domain security check already
}
Location* imp = V8Location::toNative(holder);
if (!BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), imp->frame(), DoNotReportSecurityError)) {
- static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(V8Location::assignCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(info.GetIsolate()))));
+ static v8::Persistent<v8::FunctionTemplate> sharedTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, v8::FunctionTemplate::New(V8Location::assignCallback, v8Undefined(), v8::Signature::New(V8Location::GetRawTemplate(isolate))));
return sharedTemplate->GetFunction();
}
return privateTemplate->GetFunction();
+2013-02-08 Dan Carney <dcarney@google.com>
+
+ [v8] isolate parameter added to all v8::peristent calls
+ https://bugs.webkit.org/show_bug.cgi?id=109268
+
+ Reviewed by Kentaro Hara.
+
+ * tests/WebFrameTest.cpp:
+
2013-02-07 Kent Tamura <tkent@chromium.org>
[Chromium-Android] Disable input[type=datetime]
struct Notification {
public:
Notification(WebFrame* frame, v8::Handle<v8::Context> context, int worldId)
- : frame(frame) ,
- context(v8::Persistent<v8::Context>::New(context)),
- worldId(worldId)
+ : frame(frame)
+ , context(v8::Persistent<v8::Context>::New(context->GetIsolate(), context))
+ , worldId(worldId)
{
}
~Notification()
{
- context.Dispose();
+ context.Dispose(context->GetIsolate());
}
bool Equals(Notification* other)