https://bugs.webkit.org/show_bug.cgi?id=84273
Reviewed by Nate Chapin.
The objective is to pass Isolate to all toV8()s.
Since there are a lot of toV8()s, I'll make the change
step by step. This patch passes Isolate to toV8() in
several custom bindings.
No tests. No change in behavior.
* bindings/v8/custom/V8HTMLAllCollectionCustom.cpp:
(WebCore::getNamedItems):
(WebCore::getItem):
(WebCore::V8HTMLAllCollection::namedPropertyGetter):
(WebCore::V8HTMLAllCollection::itemCallback):
(WebCore::V8HTMLAllCollection::namedItemCallback):
(WebCore::V8HTMLAllCollection::callAsFunctionCallback):
* bindings/v8/custom/V8HTMLCollectionCustom.cpp:
(WebCore::getNamedItems):
(WebCore::V8HTMLCollection::namedPropertyGetter):
(WebCore::V8HTMLCollection::namedItemCallback):
(WebCore::toV8):
* bindings/v8/custom/V8SVGPathSegCustom.cpp:
(WebCore::toV8):
* bindings/v8/custom/V8StyleSheetCustom.cpp:
(WebCore::toV8):
* bindings/v8/custom/V8StyleSheetListCustom.cpp:
(WebCore::V8StyleSheetList::namedPropertyGetter):
* bindings/v8/custom/V8TrackEventCustom.cpp:
(WebCore::V8TrackEvent::trackAccessorGetter):
* bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
(WebCore::toV8Object):
(WebCore::getObjectParameter):
(WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
(WebCore::V8WebGLRenderingContext::getExtensionCallback):
(WebCore::V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback):
(WebCore::V8WebGLRenderingContext::getParameterCallback):
(WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
(WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
(WebCore::V8WebGLRenderingContext::getUniformCallback):
* bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
(WebCore::V8XMLHttpRequest::responseAccessorGetter):
* bindings/v8/custom/V8XSLTProcessorCustom.cpp:
(WebCore::V8XSLTProcessor::transformToFragmentCallback):
(WebCore::V8XSLTProcessor::transformToDocumentCallback):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114972
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-23 Kentaro Hara <haraken@chromium.org>
+
+ [V8] Pass Isolate to toV8() (Part6)
+ https://bugs.webkit.org/show_bug.cgi?id=84273
+
+ Reviewed by Nate Chapin.
+
+ The objective is to pass Isolate to all toV8()s.
+ Since there are a lot of toV8()s, I'll make the change
+ step by step. This patch passes Isolate to toV8() in
+ several custom bindings.
+
+ No tests. No change in behavior.
+
+ * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp:
+ (WebCore::getNamedItems):
+ (WebCore::getItem):
+ (WebCore::V8HTMLAllCollection::namedPropertyGetter):
+ (WebCore::V8HTMLAllCollection::itemCallback):
+ (WebCore::V8HTMLAllCollection::namedItemCallback):
+ (WebCore::V8HTMLAllCollection::callAsFunctionCallback):
+ * bindings/v8/custom/V8HTMLCollectionCustom.cpp:
+ (WebCore::getNamedItems):
+ (WebCore::V8HTMLCollection::namedPropertyGetter):
+ (WebCore::V8HTMLCollection::namedItemCallback):
+ (WebCore::toV8):
+ * bindings/v8/custom/V8SVGPathSegCustom.cpp:
+ (WebCore::toV8):
+ * bindings/v8/custom/V8StyleSheetCustom.cpp:
+ (WebCore::toV8):
+ * bindings/v8/custom/V8StyleSheetListCustom.cpp:
+ (WebCore::V8StyleSheetList::namedPropertyGetter):
+ * bindings/v8/custom/V8TrackEventCustom.cpp:
+ (WebCore::V8TrackEvent::trackAccessorGetter):
+ * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
+ (WebCore::toV8Object):
+ (WebCore::getObjectParameter):
+ (WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
+ (WebCore::V8WebGLRenderingContext::getExtensionCallback):
+ (WebCore::V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback):
+ (WebCore::V8WebGLRenderingContext::getParameterCallback):
+ (WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
+ (WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
+ (WebCore::V8WebGLRenderingContext::getUniformCallback):
+ * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+ (WebCore::V8XMLHttpRequest::responseAccessorGetter):
+ * bindings/v8/custom/V8XSLTProcessorCustom.cpp:
+ (WebCore::V8XSLTProcessor::transformToFragmentCallback):
+ (WebCore::V8XSLTProcessor::transformToDocumentCallback):
+
2012-04-23 Kent Tamura <tkent@chromium.org>
Move the content of LocalizedCalendarICU.cpp and LocalizedDateICU.cpp to ICULocale.cpp.
namespace WebCore {
-static v8::Handle<v8::Value> getNamedItems(HTMLAllCollection* collection, AtomicString name)
+static v8::Handle<v8::Value> getNamedItems(HTMLAllCollection* collection, AtomicString name, v8::Isolate* isolate)
{
Vector<RefPtr<Node> > namedItems;
collection->namedItems(name, namedItems);
return v8::Handle<v8::Value>();
if (namedItems.size() == 1)
- return toV8(namedItems.at(0).release());
+ return toV8(namedItems.at(0).release(), isolate);
- return toV8(V8NamedNodesCollection::create(namedItems));
+ return toV8(V8NamedNodesCollection::create(namedItems), isolate);
}
-static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v8::Value> argument)
+static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v8::Value> argument, v8::Isolate* isolate)
{
v8::Local<v8::Uint32> index = argument->ToArrayIndex();
if (index.IsEmpty()) {
- v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString(argument->ToString()));
+ v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString(argument->ToString()), isolate);
if (result.IsEmpty())
return v8::Undefined();
}
RefPtr<Node> result = collection->item(index->Uint32Value());
- return toV8(result.release());
+ return toV8(result.release(), isolate);
}
v8::Handle<v8::Value> V8HTMLAllCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
return notHandledByInterceptor();
HTMLAllCollection* imp = V8HTMLAllCollection::toNative(info.Holder());
- return getNamedItems(imp, v8StringToAtomicWebCoreString(name));
+ return getNamedItems(imp, v8StringToAtomicWebCoreString(name), info.GetIsolate());
}
v8::Handle<v8::Value> V8HTMLAllCollection::itemCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLAllCollection.item()");
HTMLAllCollection* imp = V8HTMLAllCollection::toNative(args.Holder());
- return getItem(imp, args[0]);
+ return getItem(imp, args[0], args.GetIsolate());
}
v8::Handle<v8::Value> V8HTMLAllCollection::namedItemCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLAllCollection.namedItem()");
HTMLAllCollection* imp = V8HTMLAllCollection::toNative(args.Holder());
- v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]));
+ v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]), args.GetIsolate());
if (result.IsEmpty())
return v8::Undefined();
HTMLAllCollection* imp = V8HTMLAllCollection::toNative(args.Holder());
if (args.Length() == 1)
- return getItem(imp, args[0]);
+ return getItem(imp, args[0], args.GetIsolate());
// If there is a second argument it is the index of the item we want.
String name = toWebCoreString(args[0]);
namespace WebCore {
-static v8::Handle<v8::Value> getNamedItems(HTMLCollection* collection, AtomicString name)
+static v8::Handle<v8::Value> getNamedItems(HTMLCollection* collection, AtomicString name, v8::Isolate* isolate)
{
Vector<RefPtr<Node> > namedItems;
collection->namedItems(name, namedItems);
return v8::Handle<v8::Value>();
if (namedItems.size() == 1)
- return toV8(namedItems.at(0).release());
+ return toV8(namedItems.at(0).release(), isolate);
- return toV8(V8NamedNodesCollection::create(namedItems));
+ return toV8(V8NamedNodesCollection::create(namedItems), isolate);
}
v8::Handle<v8::Value> V8HTMLCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
return notHandledByInterceptor();
HTMLCollection* imp = V8HTMLCollection::toNative(info.Holder());
- return getNamedItems(imp, v8StringToAtomicWebCoreString(name));
+ return getNamedItems(imp, v8StringToAtomicWebCoreString(name), info.GetIsolate());
}
v8::Handle<v8::Value> V8HTMLCollection::namedItemCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLCollection.namedItem()");
HTMLCollection* imp = V8HTMLCollection::toNative(args.Holder());
- v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]));
+ v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]), args.GetIsolate());
if (result.IsEmpty())
return v8::Undefined();
if (!impl)
return v8::Null();
if (impl->isCSSStyleSheet())
- return toV8(static_cast<CSSStyleSheet*>(impl));
+ return toV8(static_cast<CSSStyleSheet*>(impl), isolate);
v8::Handle<v8::Object> wrapper = V8StyleSheet::wrap(impl);
// Add a hidden reference from stylesheet object to its owner node.
Node* ownerNode = impl->ownerNode();
if (ownerNode && !wrapper.IsEmpty())
- V8DOMWrapper::setNamedHiddenReference(wrapper, "ownerNode", toV8(ownerNode));
+ V8DOMWrapper::setNamedHiddenReference(wrapper, "ownerNode", toV8(ownerNode, isolate));
return wrapper;
}
if (!item)
return notHandledByInterceptor();
- return toV8(item->sheet());
+ return toV8(item->sheet(), info.GetIsolate());
}
} // namespace WebCore
break;
case TrackBase::TextTrack:
- return toV8(static_cast<TextTrack*>(track));
+ return toV8(static_cast<TextTrack*>(track), info.GetIsolate());
break;
case TrackBase::AudioTrack:
return data;
}
-static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info)
+static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info, v8::Isolate* isolate)
{
switch (info.getType()) {
case WebGLGetInfo::kTypeBool:
case WebGLGetInfo::kTypeUnsignedInt:
return v8::Integer::NewFromUnsigned(info.getUnsignedInt());
case WebGLGetInfo::kTypeWebGLBuffer:
- return toV8(info.getWebGLBuffer());
+ return toV8(info.getWebGLBuffer(), isolate);
case WebGLGetInfo::kTypeWebGLFloatArray:
- return toV8(info.getWebGLFloatArray());
+ return toV8(info.getWebGLFloatArray(), isolate);
case WebGLGetInfo::kTypeWebGLFramebuffer:
- return toV8(info.getWebGLFramebuffer());
+ return toV8(info.getWebGLFramebuffer(), isolate);
case WebGLGetInfo::kTypeWebGLIntArray:
- return toV8(info.getWebGLIntArray());
+ return toV8(info.getWebGLIntArray(), isolate);
// FIXME: implement WebGLObjectArray
// case WebGLGetInfo::kTypeWebGLObjectArray:
case WebGLGetInfo::kTypeWebGLProgram:
- return toV8(info.getWebGLProgram());
+ return toV8(info.getWebGLProgram(), isolate);
case WebGLGetInfo::kTypeWebGLRenderbuffer:
- return toV8(info.getWebGLRenderbuffer());
+ return toV8(info.getWebGLRenderbuffer(), isolate);
case WebGLGetInfo::kTypeWebGLTexture:
- return toV8(info.getWebGLTexture());
+ return toV8(info.getWebGLTexture(), isolate);
case WebGLGetInfo::kTypeWebGLUnsignedByteArray:
- return toV8(info.getWebGLUnsignedByteArray());
+ return toV8(info.getWebGLUnsignedByteArray(), isolate);
case WebGLGetInfo::kTypeWebGLUnsignedIntArray:
- return toV8(info.getWebGLUnsignedIntArray());
+ return toV8(info.getWebGLUnsignedIntArray(), isolate);
case WebGLGetInfo::kTypeWebGLVertexArrayObjectOES:
- return toV8(info.getWebGLVertexArrayObjectOES());
+ return toV8(info.getWebGLVertexArrayObjectOES(), isolate);
default:
notImplemented();
return v8::Undefined();
}
}
-static v8::Handle<v8::Value> toV8Object(WebGLExtension* extension, v8::Handle<v8::Object> contextObject)
+static v8::Handle<v8::Value> toV8Object(WebGLExtension* extension, v8::Handle<v8::Object> contextObject, v8::Isolate* isolate)
{
if (!extension)
return v8::Null();
const char* referenceName = 0;
switch (extension->getName()) {
case WebGLExtension::WebKitWebGLLoseContextName:
- extensionObject = toV8(static_cast<WebGLLoseContext*>(extension));
+ extensionObject = toV8(static_cast<WebGLLoseContext*>(extension), isolate);
referenceName = "webKitWebGLLoseContextName";
break;
case WebGLExtension::EXTTextureFilterAnisotropicName:
- extensionObject = toV8(static_cast<EXTTextureFilterAnisotropic*>(extension));
+ extensionObject = toV8(static_cast<EXTTextureFilterAnisotropic*>(extension), isolate);
referenceName = "extTextureFilterAnisotropicName";
break;
case WebGLExtension::OESStandardDerivativesName:
- extensionObject = toV8(static_cast<OESStandardDerivatives*>(extension));
+ extensionObject = toV8(static_cast<OESStandardDerivatives*>(extension), isolate);
referenceName = "oesStandardDerivativesName";
break;
case WebGLExtension::OESTextureFloatName:
- extensionObject = toV8(static_cast<OESTextureFloat*>(extension));
+ extensionObject = toV8(static_cast<OESTextureFloat*>(extension), isolate);
referenceName = "oesTextureFloatName";
break;
case WebGLExtension::OESVertexArrayObjectName:
- extensionObject = toV8(static_cast<OESVertexArrayObject*>(extension));
+ extensionObject = toV8(static_cast<OESVertexArrayObject*>(extension), isolate);
referenceName = "oesVertexArrayObjectName";
break;
case WebGLExtension::WebGLDebugRendererInfoName:
- extensionObject = toV8(static_cast<WebGLDebugRendererInfo*>(extension));
+ extensionObject = toV8(static_cast<WebGLDebugRendererInfo*>(extension), isolate);
referenceName = "webGLDebugRendererInfoName";
break;
case WebGLExtension::WebGLDebugShadersName:
- extensionObject = toV8(static_cast<WebGLDebugShaders*>(extension));
+ extensionObject = toV8(static_cast<WebGLDebugShaders*>(extension), isolate);
referenceName = "webGLDebugShadersName";
break;
case WebGLExtension::WebKitWebGLCompressedTextureS3TCName:
- extensionObject = toV8(static_cast<WebGLCompressedTextureS3TC*>(extension));
+ extensionObject = toV8(static_cast<WebGLCompressedTextureS3TC*>(extension), isolate);
referenceName = "webKitWebGLCompressedTextureS3TCName";
break;
}
V8Proxy::setDOMException(ec);
return v8::Undefined();
}
- return toV8Object(info);
+ return toV8Object(info, args.GetIsolate());
}
static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, bool& ok)
return v8::Null();
v8::Local<v8::Array> array = v8::Array::New(shaders.size());
for (size_t ii = 0; ii < shaders.size(); ++ii)
- array->Set(v8::Integer::New(ii), toV8(shaders[ii].get()));
+ array->Set(v8::Integer::New(ii), toV8(shaders[ii].get(), args.GetIsolate()));
return array;
}
}
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, name, args[0]);
WebGLExtension* extension = imp->getExtension(name);
- return toV8Object(extension, args.Holder());
+ return toV8Object(extension, args.Holder(), args.GetIsolate());
}
v8::Handle<v8::Value> V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback(const v8::Arguments& args)
V8Proxy::setDOMException(ec);
return v8::Undefined();
}
- return toV8Object(info);
+ return toV8Object(info, args.GetIsolate());
}
v8::Handle<v8::Value> V8WebGLRenderingContext::getParameterCallback(const v8::Arguments& args)
V8Proxy::setDOMException(ec);
return v8::Undefined();
}
- return toV8Object(info);
+ return toV8Object(info, args.GetIsolate());
}
v8::Handle<v8::Value> V8WebGLRenderingContext::getProgramParameterCallback(const v8::Arguments& args)
V8Proxy::setDOMException(ec);
return v8::Undefined();
}
- return toV8Object(info);
+ return toV8Object(info, args.GetIsolate());
}
v8::Handle<v8::Value> V8WebGLRenderingContext::getRenderbufferParameterCallback(const v8::Arguments& args)
V8Proxy::setDOMException(ec);
return v8::Undefined();
}
- return toV8Object(info);
+ return toV8Object(info, args.GetIsolate());
}
v8::Handle<v8::Value> V8WebGLRenderingContext::getSupportedExtensionsCallback(const v8::Arguments& args)
V8Proxy::setDOMException(ec);
return v8::Undefined();
}
- return toV8Object(info);
+ return toV8Object(info, args.GetIsolate());
}
v8::Handle<v8::Value> V8WebGLRenderingContext::getVertexAttribCallback(const v8::Arguments& args)
V8Proxy::setDOMException(ec);
return v8::Undefined();
}
- return toV8(document);
+ return toV8(document, info.GetIsolate());
}
case XMLHttpRequest::ResponseTypeBlob:
V8Proxy::setDOMException(ec);
return v8::Undefined();
}
- return toV8(blob);
+ return toV8(blob, info.GetIsolate());
}
#else
return v8::Undefined();
V8Proxy::setDOMException(ec);
return v8::Undefined();
}
- return toV8(arrayBuffer);
+ return toV8(arrayBuffer, info.GetIsolate());
}
}
Node* source = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0]));
Document* owner = V8Document::toNative(v8::Handle<v8::Object>::Cast(args[1]));
RefPtr<DocumentFragment> result = imp->transformToFragment(source, owner);
- return toV8(result.release());
+ return toV8(result.release(), args.GetIsolate());
}
if (!result)
return v8::Undefined();
- return toV8(result.release());
+ return toV8(result.release(), args.GetIsolate());
}