Changeset 125998 in webkit


Ignore:
Timestamp:
Aug 19, 2012 10:18:56 PM (12 years ago)
Author:
haraken@chromium.org
Message:

[V8] Move V8Proxy::callFunction() to ScriptController
https://bugs.webkit.org/show_bug.cgi?id=94437

Reviewed by Adam Barth.

To kill V8Proxy, this patch moves callFunction() from V8Proxy to ScriptController.

No tests. No change in behavior.

  • bindings/v8/DOMTransaction.cpp:

(WebCore::DOMTransaction::callFunction):

  • bindings/v8/NPV8Object.cpp:

(_NPN_Invoke):
(_NPN_InvokeDefault):

  • bindings/v8/ScheduledAction.cpp:

(WebCore::ScheduledAction::execute):

  • bindings/v8/ScheduledAction.h:

(WebCore):
(ScheduledAction):

  • bindings/v8/ScriptController.cpp:

(WebCore::ScriptController::callFunction):
(WebCore):
(WebCore::ScriptController::callFunctionEvenIfScriptDisabled):

  • bindings/v8/ScriptController.h:

(ScriptController):

  • bindings/v8/V8EventListener.cpp:

(WebCore::V8EventListener::callListenerFunction):

  • bindings/v8/V8LazyEventListener.cpp:

(WebCore::V8LazyEventListener::callListenerFunction):

  • bindings/v8/V8Proxy.cpp:
  • bindings/v8/V8Proxy.h:

(V8Proxy):

  • bindings/v8/custom/V8HTMLDocumentCustom.cpp:

(WebCore::V8HTMLDocument::openCallback):

Location:
trunk/Source/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r125997 r125998  
     12012-08-19  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Move V8Proxy::callFunction() to ScriptController
     4        https://bugs.webkit.org/show_bug.cgi?id=94437
     5
     6        Reviewed by Adam Barth.
     7
     8        To kill V8Proxy, this patch moves callFunction() from V8Proxy to ScriptController.
     9
     10        No tests. No change in behavior.
     11
     12        * bindings/v8/DOMTransaction.cpp:
     13        (WebCore::DOMTransaction::callFunction):
     14        * bindings/v8/NPV8Object.cpp:
     15        (_NPN_Invoke):
     16        (_NPN_InvokeDefault):
     17        * bindings/v8/ScheduledAction.cpp:
     18        (WebCore::ScheduledAction::execute):
     19        * bindings/v8/ScheduledAction.h:
     20        (WebCore):
     21        (ScheduledAction):
     22        * bindings/v8/ScriptController.cpp:
     23        (WebCore::ScriptController::callFunction):
     24        (WebCore):
     25        (WebCore::ScriptController::callFunctionEvenIfScriptDisabled):
     26        * bindings/v8/ScriptController.h:
     27        (ScriptController):
     28        * bindings/v8/V8EventListener.cpp:
     29        (WebCore::V8EventListener::callListenerFunction):
     30        * bindings/v8/V8LazyEventListener.cpp:
     31        (WebCore::V8LazyEventListener::callListenerFunction):
     32        * bindings/v8/V8Proxy.cpp:
     33        * bindings/v8/V8Proxy.h:
     34        (V8Proxy):
     35        * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
     36        (WebCore::V8HTMLDocument::openCallback):
     37
    1382012-08-19  Yoshifumi Inoue  <yosin@chromium.org>
    239
  • trunk/Source/WebCore/bindings/v8/DOMTransaction.cpp

    r125865 r125998  
    114114        return;
    115115    v8::Handle<v8::Value> parameters[0] = { };
    116     frame->script()->proxy()->callFunction(function, receiver, 0, parameters);
     116    frame->script()->callFunction(function, receiver, 0, parameters);
    117117}
    118118
  • trunk/Source/WebCore/bindings/v8/NPV8Object.cpp

    r125615 r125998  
    245245    }
    246246
    247     V8Proxy* proxy = toV8Proxy(npObject);
    248     ASSERT(proxy);
     247    Frame* frame = v8NpObject->rootObject->frame();
     248    ASSERT(frame);
    249249
    250250    // Call the function object.
    251251    v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(functionObject);
    252252    OwnArrayPtr<v8::Handle<v8::Value> > argv = createValueListFromVariantArgs(arguments, argumentCount, npObject);
    253     v8::Local<v8::Value> resultObject = proxy->callFunction(function, v8NpObject->v8Object, argumentCount, argv.get());
     253    v8::Local<v8::Value> resultObject = frame->script()->callFunction(function, v8NpObject->v8Object, argumentCount, argv.get());
    254254
    255255    // If we had an error, return false.  The spec is a little unclear here, but says "Returns true if the method was
     
    296296    v8::Handle<v8::Function> function(v8::Function::Cast(*functionObject));
    297297    if (!function->IsNull()) {
    298         V8Proxy* proxy = toV8Proxy(npObject);
    299         ASSERT(proxy);
     298        Frame* frame = v8NpObject->rootObject->frame();
     299        ASSERT(frame);
    300300
    301301        OwnArrayPtr<v8::Handle<v8::Value> > argv = createValueListFromVariantArgs(arguments, argumentCount, npObject);
    302         resultObject = proxy->callFunction(function, functionObject, argumentCount, argv.get());
     302        resultObject = frame->script()->callFunction(function, functionObject, argumentCount, argv.get());
    303303    }
    304304    // If we had an error, return false.  The spec is a little unclear here, but says "Returns true if the method was
  • trunk/Source/WebCore/bindings/v8/ScheduledAction.cpp

    r124931 r125998  
    4141#endif
    4242
     43#include "ScriptController.h"
    4344#include "V8Binding.h"
    4445#include "V8Proxy.h"
     
    103104        if (!frame->script()->canExecuteScripts(AboutToExecuteScript))
    104105            return;
    105         execute(frame->script()->proxy());
     106        execute(frame->script());
    106107    }
    107108#if ENABLE(WORKERS)
     
    113114}
    114115
    115 void ScheduledAction::execute(V8Proxy* proxy)
     116void ScheduledAction::execute(ScriptController* script)
    116117{
    117     ASSERT(proxy);
     118    ASSERT(script->proxy());
    118119
    119120    v8::HandleScope handleScope;
     
    130131    // FIXME: Need to implement timeouts for preempting a long-running script.
    131132    if (!m_function.IsEmpty() && m_function->IsFunction())
    132         proxy->callFunction(v8::Persistent<v8::Function>::Cast(m_function), v8Context->Global(), m_argc, m_argv);
     133        script->callFunction(v8::Persistent<v8::Function>::Cast(m_function), v8Context->Global(), m_argc, m_argv);
    133134    else
    134         proxy->evaluate(m_code, 0);
     135        script->proxy()->evaluate(m_code, 0);
    135136
    136137    // The 'proxy' may be invalid at this point since JS could have released the owning Frame.
  • trunk/Source/WebCore/bindings/v8/ScheduledAction.h

    r95901 r125998  
    4141namespace WebCore {
    4242
     43    class ScriptController;
    4344    class ScriptExecutionContext;
    44     class V8Proxy;
    4545    class WorkerContext;
    4646
     
    6060
    6161    private:
    62         void execute(V8Proxy*);
     62        void execute(ScriptController*);
    6363#if ENABLE(WORKERS)
    6464        void execute(WorkerContext*);
  • trunk/Source/WebCore/bindings/v8/ScriptController.cpp

    r125993 r125998  
    160160}
    161161
     162v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
     163{
     164    // Keep Frame (and therefore ScriptController and V8Proxy) alive.
     165    RefPtr<Frame> protect(m_frame);
     166    return V8Proxy::instrumentedCallFunction(m_frame, function, receiver, argc, args);
     167}
     168
    162169ScriptValue ScriptController::callFunctionEvenIfScriptDisabled(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> argv[])
    163170{
    164171    // FIXME: This should probably perform the same isPaused check that happens in ScriptController::executeScript.
    165     return ScriptValue(m_proxy->callFunction(function, receiver, argc, argv));
     172    return ScriptValue(callFunction(function, receiver, argc, argv));
    166173}
    167174
  • trunk/Source/WebCore/bindings/v8/ScriptController.h

    r125993 r125998  
    7272    ScriptValue executeScript(const ScriptSourceCode&);
    7373    ScriptValue executeScript(const String& script, bool forceUserGesture = false);
     74
     75    // Call the function with the given receiver and arguments.
     76    v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]);
     77
    7478    ScriptValue callFunctionEvenIfScriptDisabled(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]);
    7579
  • trunk/Source/WebCore/bindings/v8/V8EventListener.cpp

    r124583 r125998  
    9494        return v8::Local<v8::Value>();
    9595
    96     return frame->script()->proxy()->callFunction(handlerFunction, receiver, 1, parameters);
     96    return frame->script()->callFunction(handlerFunction, receiver, 1, parameters);
    9797}
    9898
  • trunk/Source/WebCore/bindings/v8/V8LazyEventListener.cpp

    r125216 r125998  
    101101        return v8::Local<v8::Value>();
    102102
    103     return frame->script()->proxy()->callFunction(handlerFunction, receiver, 1, parameters);
     103    return frame->script()->callFunction(handlerFunction, receiver, 1, parameters);
    104104}
    105105
  • trunk/Source/WebCore/bindings/v8/V8Proxy.cpp

    r125993 r125998  
    269269}
    270270
    271 v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
    272 {
    273     // Keep Frame (and therefore ScriptController and V8Proxy) alive.
    274     RefPtr<Frame> protect(frame());
    275     return V8Proxy::instrumentedCallFunction(frame(), function, receiver, argc, args);
    276 }
    277 
    278271static inline void resourceInfo(const v8::Handle<v8::Function> function, String& resourceName, int& lineNumber)
    279272{
  • trunk/Source/WebCore/bindings/v8/V8Proxy.h

    r125993 r125998  
    104104        v8::Local<v8::Value> runScript(v8::Handle<v8::Script>);
    105105
    106         // Call the function with the given receiver and arguments.
    107         v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]);
    108 
    109106        // call the function with the given receiver and arguments and report times to DevTools.
    110107        static v8::Local<v8::Value> instrumentedCallFunction(Frame*, v8::Handle<v8::Function>, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]);
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp

    r125615 r125998  
    158158                params[i] = args[i];
    159159
    160             return frame->script()->proxy()->callFunction(v8::Local<v8::Function>::Cast(function), global, args.Length(), params.get());
     160            return frame->script()->callFunction(v8::Local<v8::Function>::Cast(function), global, args.Length(), params.get());
    161161        }
    162162    }
Note: See TracChangeset for help on using the changeset viewer.