Changeset 64653 in webkit


Ignore:
Timestamp:
Aug 4, 2010 8:26:33 AM (14 years ago)
Author:
yurys@chromium.org
Message:

2010-08-04 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: use InspectorValue to push dispatch results from the injected script
https://bugs.webkit.org/show_bug.cgi?id=43483

  • bindings/js/JSInjectedScriptHostCustom.cpp: (WebCore::JSInjectedScriptHost::reportDidDispatchOnInjectedScript):
  • bindings/v8/custom/V8InjectedScriptHostCustom.cpp: (WebCore::V8InjectedScriptHost::reportDidDispatchOnInjectedScriptCallback):
  • inspector/InjectedScript.cpp: (WebCore::InjectedScript::dispatch):
  • inspector/InjectedScript.h:
  • inspector/InjectedScriptHost.cpp: (WebCore::InjectedScriptHost::reportDidDispatchOnInjectedScript): (WebCore::InjectedScriptHost::remoteFrontend):
  • inspector/InjectedScriptHost.h:
  • inspector/Inspector.idl:
  • inspector/InspectorBackend.cpp: (WebCore::InspectorBackend::dispatchOnInjectedScript):
  • inspector/InspectorController.cpp: (WebCore::InspectorController::didContinue):
  • inspector/InspectorFrontend.cpp:
  • inspector/InspectorFrontend.h:
Location:
trunk/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r64651 r64653  
     12010-08-04  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: use InspectorValue to push dispatch results from the injected script
     6        https://bugs.webkit.org/show_bug.cgi?id=43483
     7
     8        * bindings/js/JSInjectedScriptHostCustom.cpp:
     9        (WebCore::JSInjectedScriptHost::reportDidDispatchOnInjectedScript):
     10        * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
     11        (WebCore::V8InjectedScriptHost::reportDidDispatchOnInjectedScriptCallback):
     12        * inspector/InjectedScript.cpp:
     13        (WebCore::InjectedScript::dispatch):
     14        * inspector/InjectedScript.h:
     15        * inspector/InjectedScriptHost.cpp:
     16        (WebCore::InjectedScriptHost::reportDidDispatchOnInjectedScript):
     17        (WebCore::InjectedScriptHost::remoteFrontend):
     18        * inspector/InjectedScriptHost.h:
     19        * inspector/Inspector.idl:
     20        * inspector/InspectorBackend.cpp:
     21        (WebCore::InspectorBackend::dispatchOnInjectedScript):
     22        * inspector/InspectorController.cpp:
     23        (WebCore::InspectorController::didContinue):
     24        * inspector/InspectorFrontend.cpp:
     25        * inspector/InspectorFrontend.h:
     26
    1272010-08-04  Abhishek Arya  <inferno@chromium.org>
    228
  • trunk/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp

    r60631 r64653  
    4949#include "InspectorController.h"
    5050#include "InspectorResource.h"
     51#include "InspectorValues.h"
    5152#include "JSDOMWindow.h"
    5253#include "JSDOMWindowCustom.h"
     
    5657#include "Page.h"
    5758#if ENABLE(DOM_STORAGE)
    58 #include "SerializedScriptValue.h"
    5959#include "Storage.h"
    6060#include "JSStorage.h"
     
    202202    int callId = exec->argument(0).asInt32();
    203203   
    204     RefPtr<SerializedScriptValue> result(SerializedScriptValue::create(exec, exec->argument(1)));
     204    RefPtr<InspectorValue> result = ScriptValue(exec->argument(1)).toInspectorValue(exec);
    205205   
    206206    bool isException;
    207207    if (!exec->argument(2).getBoolean(isException))
    208208        return jsUndefined();
    209     impl()->reportDidDispatchOnInjectedScript(callId, result.get(), isException);
     209    impl()->reportDidDispatchOnInjectedScript(callId, result, isException);
    210210    return jsUndefined();
    211211}
  • trunk/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp

    r58166 r64653  
    3838#include "InjectedScriptHost.h"
    3939#include "InspectorController.h"
     40#include "InspectorValues.h"
    4041#include "Node.h"
    4142#include "Page.h"
    4243#include "ScriptDebugServer.h"
    43 #include "SerializedScriptValue.h"
    4444
    4545#include "V8Binding.h"
     
    216216    InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
    217217    int callId = args[0]->ToInt32()->Value();
    218     RefPtr<SerializedScriptValue> result(SerializedScriptValue::create(args[1]));
     218    RefPtr<InspectorValue> result = ScriptValue(args[1]).toInspectorValue(ScriptState::current());
    219219    bool isException = args[2]->ToBoolean()->Value();
    220     host->reportDidDispatchOnInjectedScript(callId, result.get(), isException);
     220    host->reportDidDispatchOnInjectedScript(callId, result, isException);
    221221    return v8::Undefined();
    222222}
  • trunk/WebCore/inspector/InjectedScript.cpp

    r64540 r64653  
    3636#include "InspectorValues.h"
    3737#include "PlatformString.h"
    38 #include "SerializedScriptValue.h"
    3938#include "ScriptFunctionCall.h"
    4039
     
    4645}
    4746
    48 void InjectedScript::dispatch(long callId, const String& methodName, const String& arguments, bool async, RefPtr<SerializedScriptValue>* result, bool* hadException)
     47void InjectedScript::dispatch(long callId, const String& methodName, const String& arguments, bool async, RefPtr<InspectorValue>* result, bool* hadException)
    4948{
    5049    ASSERT(!hasNoValue());
     
    6261    ScriptValue resultValue = function.call(*hadException);
    6362    if (!*hadException)
    64         *result = resultValue.serialize(m_injectedScriptObject.scriptState());
     63        *result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState());
    6564}
    6665
  • trunk/WebCore/inspector/InjectedScript.h

    r64540 r64653  
    4040
    4141class InspectorValue;
    42 class SerializedScriptValue;
    4342class String;
    4443
     
    5049    bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
    5150
    52     void dispatch(long callId, const String& methodName, const String& arguments, bool async, RefPtr<SerializedScriptValue>* result, bool* hadException);
     51    void dispatch(long callId, const String& methodName, const String& arguments, bool async, RefPtr<InspectorValue>* result, bool* hadException);
    5352#if ENABLE(JAVASCRIPT_DEBUGGER)
    5453    PassRefPtr<InspectorValue> callFrames();
  • trunk/WebCore/inspector/InjectedScriptHost.cpp

    r61655 r64653  
    4646#include "InspectorResource.h"
    4747#include "Pasteboard.h"
     48#include "RemoteInspectorFrontend.h"
    4849
    4950#if ENABLE(JAVASCRIPT_DEBUGGER)
     
    143144#endif
    144145
    145 void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException)
    146 {
    147     if (InspectorFrontend* frontend = inspectorFrontend())
     146void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, PassRefPtr<InspectorValue> result, bool isException)
     147{
     148    if (RemoteInspectorFrontend* frontend = remoteFrontend())
    148149        frontend->didDispatchOnInjectedScript(callId, result, isException);
    149150}
     
    186187}
    187188
     189RemoteInspectorFrontend* InjectedScriptHost::remoteFrontend()
     190{
     191    if (!m_inspectorController)
     192        return 0;
     193    return m_inspectorController->m_remoteFrontend.get();
     194}
     195
    188196pair<long, ScriptObject> InjectedScriptHost::injectScript(const String& source, ScriptState* scriptState)
    189197{
  • trunk/WebCore/inspector/InjectedScriptHost.h

    r61655 r64653  
    4646class InspectorFrontend;
    4747class Node;
    48 class SerializedScriptValue;
     48class RemoteInspectorFrontend;
    4949class Storage;
    5050
     
    8383    void didDestroyWorker(long id);
    8484#endif
    85     void reportDidDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException);
     85    void reportDidDispatchOnInjectedScript(long callId, PassRefPtr<InspectorValue> result, bool isException);
    8686
    8787    pair<long, ScriptObject> injectScript(const String& source, ScriptState*);
     
    9797    InspectorDOMAgent* inspectorDOMAgent();
    9898    InspectorFrontend* inspectorFrontend();
     99    RemoteInspectorFrontend* remoteFrontend();
    99100    ScriptObject createInjectedScript(const String& source, ScriptState* scriptState, long id);
    100101
  • trunk/WebCore/inspector/Inspector.idl

    r64650 r64653  
    113113#endif
    114114        [handler=Backend] void setInjectedScriptSource(in String scriptSource);
    115         [handler=Backend] void dispatchOnInjectedScript(in long callId, in long injectedScriptId, in String methodName, in String arguments, in boolean async);
    116 
     115        [handler=Backend] void dispatchOnInjectedScript(in long callId, in long injectedScriptId, in String methodName, in String arguments, in boolean async, out Value result, out boolean isException);
    117116        [handler=Controller] void addScriptToEvaluateOnLoad(in String scriptSource);
    118117        [handler=Controller] void removeAllScriptsToEvaluateOnLoad();
  • trunk/WebCore/inspector/InspectorBackend.cpp

    r64650 r64653  
    9595void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async)
    9696{
    97     InspectorFrontend* frontend = inspectorFrontend();
     97    RemoteInspectorFrontend* frontend = remoteFrontend();
    9898    if (!frontend)
    9999        return;
     
    111111        return;
    112112
    113     RefPtr<SerializedScriptValue> result;
     113    RefPtr<InspectorValue> result;
    114114    bool hadException = false;
    115115    injectedScript.dispatch(callId, methodName, arguments, async, &result, &hadException);
    116116    if (async)
    117117        return;  // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript.
    118     frontend->didDispatchOnInjectedScript(callId, result.get(), hadException);
     118    frontend->didDispatchOnInjectedScript(callId, result, hadException);
    119119}
    120120
  • trunk/WebCore/inspector/InspectorController.cpp

    r64650 r64653  
    18571857{
    18581858    m_pausedScriptState = 0;
    1859     m_frontend->resumedScript();
     1859    m_remoteFrontend->resumedScript();
    18601860}
    18611861
  • trunk/WebCore/inspector/InspectorFrontend.cpp

    r64650 r64653  
    4545#include "ScriptString.h"
    4646#include "ScriptValue.h"
    47 #include "SerializedScriptValue.h"
    4847#include <wtf/OwnPtr.h>
    4948
     
    287286}
    288287
    289 void InspectorFrontend::pausedScript(SerializedScriptValue* callFrames)
    290 {
    291     ScriptValue callFramesValue = ScriptValue::deserialize(scriptState(), callFrames);
    292     ScriptFunctionCall function(m_webInspector, "dispatch");
    293     function.appendArgument("pausedScript");
    294     function.appendArgument(callFramesValue);
    295     function.call();
    296 }
    297 
    298 void InspectorFrontend::resumedScript()
    299 {
    300     callSimpleFunction("resumedScript");
    301 }
    302 
    303288void InspectorFrontend::profilerWasEnabled()
    304289{
     
    365350    function.appendArgument(cookies);
    366351    function.appendArgument(cookiesString);
    367     function.call();
    368 }
    369 
    370 void InspectorFrontend::didDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException)
    371 {
    372     ScriptFunctionCall function(m_webInspector, "dispatch");
    373     function.appendArgument("didDispatchOnInjectedScript");
    374     function.appendArgument(callId);
    375     if (isException)
    376         function.appendArgument("");
    377     else {
    378         ScriptValue resultValue = ScriptValue::deserialize(scriptState(), result);
    379         function.appendArgument(resultValue);
    380     }
    381     function.appendArgument(isException);
    382352    function.call();
    383353}
  • trunk/WebCore/inspector/InspectorFrontend.h

    r64650 r64653  
    3939namespace WebCore {
    4040    class ConsoleMessage;
    41     class Database;
    4241    class Frame;
    4342    class InspectorClient;
     
    4645    class Node;
    4746    class ScriptString;
    48     class SerializedScriptValue;
    4947    class Storage;
    5048
     
    9896        void restoredBreakpoint(const String& sourceID, const String& url, int line, bool enabled, const String& condition);
    9997        void failedToParseScriptSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage);
    100         void pausedScript(SerializedScriptValue* callFrames);
    101         void resumedScript();
    10298
    10399        void profilerWasEnabled();
     
    133129
    134130        void didGetCookies(long callId, const ScriptArray& cookies, const String& cookiesString);
    135         void didDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException);
    136131
    137132        void contextMenuItemSelected(int itemId);
Note: See TracChangeset for help on using the changeset viewer.