Changeset 141719 in webkit


Ignore:
Timestamp:
Feb 3, 2013 3:53:55 PM (11 years ago)
Author:
haraken@chromium.org
Message:

[V8] Pass an Isolate to HasInstance() (part 3)
https://bugs.webkit.org/show_bug.cgi?id=108622

Reviewed by Adam Barth.

This is one of efforts to pass an Isolate to GetTemplate().

No tests. No change in behavior.

  • bindings/v8/custom/V8InjectedScriptHostCustom.cpp:

(WebCore::V8InjectedScriptHost::isHTMLAllCollectionCallback):
(WebCore::V8InjectedScriptHost::typeCallback):
(WebCore::V8InjectedScriptHost::getEventListenersCallback):

  • bindings/v8/custom/V8NodeCustom.cpp:

(WebCore::V8Node::insertBeforeCallback):
(WebCore::V8Node::replaceChildCallback):
(WebCore::V8Node::removeChildCallback):
(WebCore::V8Node::appendChildCallback):

  • bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:

(WebCore::toWebGLUniformLocation):
(WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
(WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
(WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
(WebCore::V8WebGLRenderingContext::getUniformCallback):
(WebCore::vertexAttribAndUniformHelperf):
(WebCore::uniformHelperi):
(WebCore::uniformMatrixHelper):

  • bindings/v8/custom/V8XMLHttpRequestCustom.cpp:

(WebCore::isDocumentType):
(WebCore::V8XMLHttpRequest::sendCallback):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r141718 r141719  
     12013-02-03  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Pass an Isolate to HasInstance() (part 3)
     4        https://bugs.webkit.org/show_bug.cgi?id=108622
     5
     6        Reviewed by Adam Barth.
     7
     8        This is one of efforts to pass an Isolate to GetTemplate().
     9
     10        No tests. No change in behavior.
     11
     12        * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
     13        (WebCore::V8InjectedScriptHost::isHTMLAllCollectionCallback):
     14        (WebCore::V8InjectedScriptHost::typeCallback):
     15        (WebCore::V8InjectedScriptHost::getEventListenersCallback):
     16        * bindings/v8/custom/V8NodeCustom.cpp:
     17        (WebCore::V8Node::insertBeforeCallback):
     18        (WebCore::V8Node::replaceChildCallback):
     19        (WebCore::V8Node::removeChildCallback):
     20        (WebCore::V8Node::appendChildCallback):
     21        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
     22        (WebCore::toWebGLUniformLocation):
     23        (WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
     24        (WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
     25        (WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
     26        (WebCore::V8WebGLRenderingContext::getUniformCallback):
     27        (WebCore::vertexAttribAndUniformHelperf):
     28        (WebCore::uniformHelperi):
     29        (WebCore::uniformMatrixHelper):
     30        * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
     31        (WebCore::isDocumentType):
     32        (WebCore::V8XMLHttpRequest::sendCallback):
     33
    1342013-02-03  Kentaro Hara  <haraken@chromium.org>
    235
  • trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp

    r140392 r141719  
    113113
    114114    v8::HandleScope handleScope;
    115     return v8::Boolean::New(V8HTMLAllCollection::HasInstance(args[0]));
     115    return v8::Boolean::New(V8HTMLAllCollection::HasInstance(args[0], args.GetIsolate()));
    116116}
    117117
     
    134134    if (value->IsRegExp())
    135135        return v8::String::NewSymbol("regexp");
    136     if (V8Node::HasInstance(value))
     136    if (V8Node::HasInstance(value, args.GetIsolate()))
    137137        return v8::String::NewSymbol("node");
    138     if (V8NodeList::HasInstance(value))
    139         return v8::String::NewSymbol("array");
    140     if (V8HTMLCollection::HasInstance(value))
    141         return v8::String::NewSymbol("array");
    142     if (V8Int8Array::HasInstance(value) || V8Int16Array::HasInstance(value) || V8Int32Array::HasInstance(value))
    143         return v8::String::NewSymbol("array");
    144     if (V8Uint8Array::HasInstance(value) || V8Uint16Array::HasInstance(value) || V8Uint32Array::HasInstance(value))
    145         return v8::String::NewSymbol("array");
    146     if (V8Float32Array::HasInstance(value) || V8Float64Array::HasInstance(value))
    147         return v8::String::NewSymbol("array");
    148     if (V8Uint8ClampedArray::HasInstance(value))
     138    if (V8NodeList::HasInstance(value, args.GetIsolate()))
     139        return v8::String::NewSymbol("array");
     140    if (V8HTMLCollection::HasInstance(value, args.GetIsolate()))
     141        return v8::String::NewSymbol("array");
     142    if (V8Int8Array::HasInstance(value, args.GetIsolate()) || V8Int16Array::HasInstance(value, args.GetIsolate()) || V8Int32Array::HasInstance(value, args.GetIsolate()))
     143        return v8::String::NewSymbol("array");
     144    if (V8Uint8Array::HasInstance(value, args.GetIsolate()) || V8Uint16Array::HasInstance(value, args.GetIsolate()) || V8Uint32Array::HasInstance(value, args.GetIsolate()))
     145        return v8::String::NewSymbol("array");
     146    if (V8Float32Array::HasInstance(value, args.GetIsolate()) || V8Float64Array::HasInstance(value, args.GetIsolate()))
     147        return v8::String::NewSymbol("array");
     148    if (V8Uint8ClampedArray::HasInstance(value, args.GetIsolate()))
    149149        return v8::String::NewSymbol("array");
    150150    return v8::Undefined();
     
    244244
    245245    v8::Local<v8::Value> value = args[0];
    246     if (!V8Node::HasInstance(value))
     246    if (!V8Node::HasInstance(value, args.GetIsolate()))
    247247        return v8::Undefined();
    248248    Node* node = V8Node::toNative(value->ToObject());
  • trunk/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp

    r138665 r141719  
    6767    Node* imp = V8Node::toNative(holder);
    6868    ExceptionCode ec = 0;
    69     Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    70     Node* refChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
     69    Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     70    Node* refChild = V8Node::HasInstance(args[1], args.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
    7171    bool success = imp->insertBefore(newChild, refChild, ec, true);
    7272    if (ec)
     
    8383    Node* imp = V8Node::toNative(holder);
    8484    ExceptionCode ec = 0;
    85     Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    86     Node* oldChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
     85    Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     86    Node* oldChild = V8Node::HasInstance(args[1], args.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
    8787    bool success = imp->replaceChild(newChild, oldChild, ec, true);
    8888    if (ec)
     
    9898    Node* imp = V8Node::toNative(holder);
    9999    ExceptionCode ec = 0;
    100     Node* oldChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     100    Node* oldChild = V8Node::HasInstance(args[0], args.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    101101    bool success = imp->removeChild(oldChild, ec);
    102102    if (ec)
     
    113113    Node* imp = V8Node::toNative(holder);
    114114    ExceptionCode ec = 0;
    115     Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     115    Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    116116    bool success = imp->appendChild(newChild, ec, true );
    117117    if (ec)
  • trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp

    r138677 r141719  
    256256}
    257257
    258 static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, bool& ok)
     258static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, bool& ok, v8::Isolate* isolate)
    259259{
    260260    ok = false;
     
    278278    ExceptionCode ec = 0;
    279279    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    280     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0]))
    281         return throwTypeError(0, args.GetIsolate());
    282     WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     280    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0], args.GetIsolate()))
     281        return throwTypeError(0, args.GetIsolate());
     282    WebGLProgram* program = V8WebGLProgram::HasInstance(args[0], args.GetIsolate()) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    283283    Vector<RefPtr<WebGLShader> > shaders;
    284284    bool succeed = context->getAttachedShaders(program, shaders, ec);
     
    347347    ExceptionCode ec = 0;
    348348    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    349     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0]))
    350         return throwTypeError(0, args.GetIsolate());
    351     WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     349    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0], args.GetIsolate()))
     350        return throwTypeError(0, args.GetIsolate());
     351    WebGLProgram* program = V8WebGLProgram::HasInstance(args[0], args.GetIsolate()) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    352352    unsigned pname = toInt32(args[1]);
    353353    WebGLGetInfo info = context->getProgramParameter(program, pname, ec);
     
    369369    ExceptionCode ec = 0;
    370370    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    371     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLShader::HasInstance(args[0]))
    372         return throwTypeError(0, args.GetIsolate());
    373     WebGLShader* shader = V8WebGLShader::HasInstance(args[0]) ? V8WebGLShader::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     371    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLShader::HasInstance(args[0], args.GetIsolate()))
     372        return throwTypeError(0, args.GetIsolate());
     373    WebGLShader* shader = V8WebGLShader::HasInstance(args[0], args.GetIsolate()) ? V8WebGLShader::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    374374    unsigned pname = toInt32(args[1]);
    375375    WebGLGetInfo info = context->getShaderParameter(shader, pname, ec);
     
    404404    ExceptionCode ec = 0;
    405405    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    406     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0]))
    407         return throwTypeError(0, args.GetIsolate());
    408     WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    409 
    410     if (args.Length() > 1 && !isUndefinedOrNull(args[1]) && !V8WebGLUniformLocation::HasInstance(args[1]))
     406    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0], args.GetIsolate()))
     407        return throwTypeError(0, args.GetIsolate());
     408    WebGLProgram* program = V8WebGLProgram::HasInstance(args[0], args.GetIsolate()) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     409
     410    if (args.Length() > 1 && !isUndefinedOrNull(args[1]) && !V8WebGLUniformLocation::HasInstance(args[1], args.GetIsolate()))
    411411        return throwTypeError(0, args.GetIsolate());
    412412    bool ok = false;
    413     WebGLUniformLocation* location = toWebGLUniformLocation(args[1], ok);
     413    WebGLUniformLocation* location = toWebGLUniformLocation(args[1], ok, args.GetIsolate());
    414414
    415415    WebGLGetInfo info = context->getUniform(program, location, ec);
     
    473473        index = toInt32(args[0]);
    474474    else {
    475         if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0]))
     475        if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0], args.GetIsolate()))
    476476            return throwTypeError(0, args.GetIsolate());
    477         location = toWebGLUniformLocation(args[0], ok);
    478     }
    479 
    480     WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    481 
    482     if (V8Float32Array::HasInstance(args[1])) {
     477        location = toWebGLUniformLocation(args[0], ok, args.GetIsolate());
     478    }
     479
     480    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
     481
     482    if (V8Float32Array::HasInstance(args[1], args.GetIsolate())) {
    483483        Float32Array* array = V8Float32Array::toNative(args[1]->ToObject());
    484484        ASSERT(array != NULL);
     
    544544
    545545    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    546     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0]))
     546    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0], args.GetIsolate()))
    547547        return throwTypeError(0, args.GetIsolate());
    548548    bool ok = false;
    549     WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok);
    550 
    551     if (V8Int32Array::HasInstance(args[1])) {
     549    WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok, args.GetIsolate());
     550
     551    if (V8Int32Array::HasInstance(args[1], args.GetIsolate())) {
    552552        Int32Array* array = V8Int32Array::toNative(args[1]->ToObject());
    553553        ASSERT(array != NULL);
     
    646646    WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
    647647
    648     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0]))
     648    if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0], args.GetIsolate()))
    649649        return throwTypeError(0, args.GetIsolate());
    650650    bool ok = false;
    651     WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok);
     651    WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok, args.GetIsolate());
    652652   
    653653    bool transpose = args[1]->BooleanValue();
    654     if (V8Float32Array::HasInstance(args[2])) {
     654    if (V8Float32Array::HasInstance(args[2], args.GetIsolate())) {
    655655        Float32Array* array = V8Float32Array::toNative(args[2]->ToObject());
    656656        ASSERT(array != NULL);
  • trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp

    r139601 r141719  
    159159}
    160160
    161 static bool isDocumentType(v8::Handle<v8::Value> value)
     161static bool isDocumentType(v8::Handle<v8::Value> value, v8::Isolate* isolate)
    162162{
    163163    // FIXME: add other document types.
    164     return V8Document::HasInstance(value) || V8HTMLDocument::HasInstance(value);
     164    return V8Document::HasInstance(value, isolate) || V8HTMLDocument::HasInstance(value, isolate);
    165165}
    166166
     
    178178        if (isUndefinedOrNull(arg))
    179179            xmlHttpRequest->send(ec);
    180         else if (isDocumentType(arg)) {
     180        else if (isDocumentType(arg, args.GetIsolate())) {
    181181            v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
    182182            Document* document = V8Document::toNative(object);
    183183            ASSERT(document);
    184184            xmlHttpRequest->send(document, ec);
    185         } else if (V8Blob::HasInstance(arg)) {
     185        } else if (V8Blob::HasInstance(arg, args.GetIsolate())) {
    186186            v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
    187187            Blob* blob = V8Blob::toNative(object);
    188188            ASSERT(blob);
    189189            xmlHttpRequest->send(blob, ec);
    190         } else if (V8DOMFormData::HasInstance(arg)) {
     190        } else if (V8DOMFormData::HasInstance(arg, args.GetIsolate())) {
    191191            v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
    192192            DOMFormData* domFormData = V8DOMFormData::toNative(object);
     
    194194            xmlHttpRequest->send(domFormData, ec);
    195195#if ENABLE(WEBGL) || ENABLE(BLOB)
    196         } else if (V8ArrayBuffer::HasInstance(arg)) {
     196        } else if (V8ArrayBuffer::HasInstance(arg, args.GetIsolate())) {
    197197            v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
    198198            ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object);
    199199            ASSERT(arrayBuffer);
    200200            xmlHttpRequest->send(arrayBuffer, ec);
    201         } else if (V8ArrayBufferView::HasInstance(arg)) {
     201        } else if (V8ArrayBufferView::HasInstance(arg, args.GetIsolate())) {
    202202            v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
    203203            ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(object);
Note: See TracChangeset for help on using the changeset viewer.