Changeset 60889 in webkit


Ignore:
Timestamp:
Jun 9, 2010 7:18:57 AM (14 years ago)
Author:
loislo@chromium.org
Message:

WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
data from inspected page to WebInspector as JSON string via http. The native
serialization to JSON string is supported by InspectorValue's classes. This patch
has the implementation of sendMessageToFrontend function. WebKit version of it still
uses ScriptFunctionCall and will be switched to another transport a little bit later.
https://bugs.webkit.org/show_bug.cgi?id=40134

  • inspector/InspectorClient.h:
  • inspector/InspectorController.cpp: (WebCore::InspectorController::connectFrontend): (WebCore::InspectorController::disconnectFrontend):
  • inspector/InspectorController.h:
  • inspector/InspectorFrontend.cpp: (WebCore::InspectorFrontend::InspectorFrontend):
  • inspector/InspectorFrontend.h:
  • inspector/InspectorFrontendClientLocal.cpp: (WebCore::InspectorFrontendClientLocal::frontendLoaded):
  • inspector/InspectorValues.cpp: (WebCore::InspectorObject::writeJSON):
  • inspector/front-end/inspector.js: (WebInspector.dispatchMessageToFrontend):
  • loader/EmptyClients.h: (WebCore::EmptyInspectorClient::sendMessageToFrontend):
  • efl/WebCoreSupport/InspectorClientEfl.cpp: (WebCore::InspectorClientEfl::sendMessageToFrontend):
  • efl/WebCoreSupport/InspectorClientEfl.h:
  • WebCoreSupport/WebInspectorClientCF.cpp: (WebInspectorClient::releaseFrontendPage): (WebInspectorClient::sendMessageToFrontend):
  • src/InspectorClientImpl.cpp: (WebKit::InspectorClientImpl::sendMessageToFrontend):
  • src/InspectorClientImpl.h:
  • src/WebDevToolsAgentImpl.cpp: (WebKit::WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController):
  • WebCoreSupport/InspectorClientGtk.cpp: (WebKit::InspectorClient::releaseFrontendPage): (WebKit::InspectorClient::sendMessageToFrontend):
  • WebCoreSupport/InspectorClientGtk.h:
  • WebCoreSupport/InspectorClientHaiku.cpp: (WebCore::InspectorClientHaiku::sendMessageToFrontend):
  • WebCoreSupport/InspectorClientHaiku.h:
  • WebCoreSupport/WebInspectorClient.h:
  • WebCoreSupport/WebInspectorClient.mm: (WebInspectorClient::WebInspectorClient): (WebInspectorClient::openInspectorFrontend):
  • WebCoreSupport/InspectorClientQt.cpp: (WebCore::InspectorClientQt::InspectorClientQt): (WebCore::InspectorClientQt::openInspectorFrontend): (WebCore::InspectorClientQt::releaseFrontendPage): (WebCore::InspectorClientQt::sendMessageToFrontend):
  • WebCoreSupport/InspectorClientQt.h:
  • WebCoreSupport/WebInspectorClient.cpp: (WebInspectorClient::WebInspectorClient): (WebInspectorClient::~WebInspectorClient): (WebInspectorClient::openInspectorFrontend):
  • WebCoreSupport/WebInspectorClient.h:
  • WebKitSupport/InspectorClientWx.cpp: (WebCore::InspectorClientWx::sendMessageToFrontend):
  • WebKitSupport/InspectorClientWx.h:
Location:
trunk
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r60887 r60889  
     12010-06-07  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
     6        data from inspected page to WebInspector as JSON string via http. The native
     7        serialization to JSON string is supported by InspectorValue's classes. This patch
     8        has the implementation of sendMessageToFrontend function. WebKit version of it still
     9        uses ScriptFunctionCall and will be switched to another transport a little bit later.
     10        https://bugs.webkit.org/show_bug.cgi?id=40134
     11
     12        * inspector/InspectorClient.h:
     13        * inspector/InspectorController.cpp:
     14        (WebCore::InspectorController::connectFrontend):
     15        (WebCore::InspectorController::disconnectFrontend):
     16        * inspector/InspectorController.h:
     17        * inspector/InspectorFrontend.cpp:
     18        (WebCore::InspectorFrontend::InspectorFrontend):
     19        * inspector/InspectorFrontend.h:
     20        * inspector/InspectorFrontendClientLocal.cpp:
     21        (WebCore::InspectorFrontendClientLocal::frontendLoaded):
     22        * inspector/InspectorValues.cpp:
     23        (WebCore::InspectorObject::writeJSON):
     24        * inspector/front-end/inspector.js:
     25        (WebInspector.dispatchMessageToFrontend):
     26        * loader/EmptyClients.h:
     27        (WebCore::EmptyInspectorClient::sendMessageToFrontend):
     28
    1292010-06-09  Csaba Osztrogonác  <ossy@webkit.org>
    230
  • trunk/WebCore/inspector/InspectorClient.h

    r56051 r60889  
    4949    virtual void populateSetting(const String& key, String* value) = 0;
    5050    virtual void storeSetting(const String& key, const String& value) = 0;
     51
     52    virtual bool sendMessageToFrontend(const String& message) = 0;
    5153};
    5254
  • trunk/WebCore/inspector/InspectorController.cpp

    r60843 r60889  
    426426}
    427427
    428 void InspectorController::setFrontend(PassOwnPtr<InspectorFrontend> frontend)
    429 {
    430     ASSERT(frontend);
     428void InspectorController::connectFrontend(const ScriptObject& webInspector)
     429{
    431430    m_openingFrontend = false;
    432     m_frontend = frontend;
     431    m_frontend = new InspectorFrontend(webInspector, m_client);
    433432    releaseDOMAgent();
    434433    m_domAgent = InspectorDOMAgent::create(m_cssStore.get(), m_frontend.get());
  • trunk/WebCore/inspector/InspectorController.h

    r60843 r60889  
    135135    void showPanel(SpecialPanels);
    136136    void close();
     137
     138    // We are in transition from JS transport via webInspector to native
     139    // transport via InspectorClient. After migration, webInspector parameter should
     140    // be removed.
     141    void connectFrontend(const ScriptObject& webInspector);
    137142    void disconnectFrontend();
    138143
     
    152157
    153158    bool windowVisible();
    154     void setFrontend(PassOwnPtr<InspectorFrontend>);
    155159
    156160    void didCommitLoad(DocumentLoader*);
  • trunk/WebCore/inspector/InspectorFrontend.cpp

    r60843 r60889  
    3737#include "InjectedScript.h"
    3838#include "InjectedScriptHost.h"
     39#include "InspectorClient.h"
    3940#include "InspectorController.h"
    4041#include "InspectorWorkerResource.h"
     
    5051namespace WebCore {
    5152
    52 InspectorFrontend::InspectorFrontend(ScriptObject webInspector)
    53     : m_webInspector(webInspector)
     53InspectorFrontend::InspectorFrontend(ScriptObject webInspector, InspectorClient* inspectorClient)
     54    : m_webInspector(webInspector), m_inspectorClient(inspectorClient)
    5455{
    5556}
  • trunk/WebCore/inspector/InspectorFrontend.h

    r60843 r60889  
    3131#define InspectorFrontend_h
    3232
     33#include "InspectorValues.h"
    3334#include "ScriptArray.h"
    3435#include "ScriptObject.h"
     
    4041    class Database;
    4142    class Frame;
     43    class InspectorClient;
    4244    class InspectorResource;
     45    class InspectorWorkerResource;
    4346    class Node;
    4447    class ScriptString;
    4548    class SerializedScriptValue;
    4649    class Storage;
    47     class InspectorWorkerResource;
    4850
    4951    class InspectorFrontend : public Noncopyable {
    5052    public:
    51         InspectorFrontend(ScriptObject webInspector);
     53        // We are in transition from JS transport via webInspector to native
     54        // transport via inspectorClient. After migration, webInspector parameter should
     55        // be removed.
     56        InspectorFrontend(ScriptObject webInspector, InspectorClient* inspectorClient);
    5257        ~InspectorFrontend();
    5358
     
    172177        void callSimpleFunction(const String& functionName);
    173178        ScriptObject m_webInspector;
     179        InspectorClient* m_inspectorClient;
    174180    };
    175181
  • trunk/WebCore/inspector/InspectorFrontendClientLocal.cpp

    r57146 r60889  
    9090        return;
    9191    }
    92     m_inspectorController->setFrontend(new InspectorFrontend(webInspectorObj));
     92    m_inspectorController->connectFrontend(webInspectorObj);
    9393}
    9494
  • trunk/WebCore/inspector/InspectorValues.cpp

    r60774 r60889  
    626626        Dictionary::const_iterator it = m_data.find(m_order[i]);
    627627        ASSERT(it != m_data.end());
    628         if (it != m_data.begin())
     628        if (i)
    629629            output->append(',');
    630630        doubleQuoteString(it->first, output);
  • trunk/WebCore/inspector/front-end/inspector.js

    r60771 r60889  
    572572    setTimeout(delayDispatch, 0);
    573573}
     574
     575WebInspector.dispatchMessageFromBackend = function(arguments)
     576{
     577    var methodName = arguments.shift();
     578    WebInspector[methodName].apply(this, arguments);
     579}
     580
    574581
    575582WebInspector.windowResize = function(event)
  • trunk/WebCore/loader/EmptyClients.h

    r58686 r60889  
    487487    virtual void populateSetting(const String&, String*) { }
    488488    virtual void storeSetting(const String&, const String&) { }
     489    virtual bool sendMessageToFrontend(const String&) { return false; }
    489490};
    490491
  • trunk/WebKit/ChangeLog

    r60488 r60889  
     12010-06-07  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
     6        data from inspected page to WebInspector as JSON string via http. The native
     7        serialization to JSON string is supported by InspectorValue's classes. This patch
     8        has the implementation of sendMessageToFrontend function. WebKit version of it still
     9        uses ScriptFunctionCall and will be switched to another transport a little bit later.
     10        https://bugs.webkit.org/show_bug.cgi?id=40134
     11
     12        * efl/WebCoreSupport/InspectorClientEfl.cpp:
     13        (WebCore::InspectorClientEfl::sendMessageToFrontend):
     14        * efl/WebCoreSupport/InspectorClientEfl.h:
     15
    1162010-06-01  Alexey Proskuryakov  <ap@apple.com>
    217
  • trunk/WebKit/cf/ChangeLog

    r52956 r60889  
     12010-06-07  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
     6        data from inspected page to WebInspector as JSON string via http. The native
     7        serialization to JSON string is supported by InspectorValue's classes. This patch
     8        has the implementation of sendMessageToFrontend function. WebKit version of it still
     9        uses ScriptFunctionCall and will be switched to another transport a little bit later.
     10        https://bugs.webkit.org/show_bug.cgi?id=40134
     11
     12        * WebCoreSupport/WebInspectorClientCF.cpp:
     13        (WebInspectorClient::releaseFrontendPage):
     14        (WebInspectorClient::sendMessageToFrontend):
     15
    1162010-01-07  Alexey Proskuryakov  <ap@apple.com>
    217
  • trunk/WebKit/cf/WebCoreSupport/WebInspectorClientCF.cpp

    r52956 r60889  
    5454#include <CoreFoundation/CoreFoundation.h>
    5555
     56#include <WebCore/Frame.h>
     57#include <WebCore/Page.h>
    5658#include <WebCore/PlatformString.h>
    5759
     
    9395    CFPreferencesSetAppValue(preferencesKey.get(), objectToStore.get(), kCFPreferencesCurrentApplication);
    9496}
     97
     98void WebInspectorClient::releaseFrontendPage()
     99{
     100    m_frontendPage = 0;
     101}
     102
     103bool WebInspectorClient::sendMessageToFrontend(const String& message)
     104{
     105    if (!m_frontendPage)
     106        return false;
     107
     108    Frame* frame = m_frontendPage->mainFrame();
     109    if (!frame)
     110        return false;
     111
     112    ScriptController* scriptController = frame->script();
     113    if (!scriptController)
     114        return false;
     115
     116    String dispatchToFrontend("WebInspector.dispatchMessageFromBackend(");
     117    dispatchToFrontend += message;
     118    dispatchToFrontend += ");";
     119    scriptController->executeScript(dispatchToFrontend);
     120    return true;
     121}
  • trunk/WebKit/chromium/ChangeLog

    r60886 r60889  
     12010-06-07  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
     6        data from inspected page to WebInspector as JSON string via http. The native
     7        serialization to JSON string is supported by InspectorValue's classes. This patch
     8        has the implementation of sendMessageToFrontend function. WebKit version of it still
     9        uses ScriptFunctionCall and will be switched to another transport a little bit later.
     10        https://bugs.webkit.org/show_bug.cgi?id=40134
     11
     12        * src/InspectorClientImpl.cpp:
     13        (WebKit::InspectorClientImpl::sendMessageToFrontend):
     14        * src/InspectorClientImpl.h:
     15        * src/WebDevToolsAgentImpl.cpp:
     16        (WebKit::WebDevToolsAgentImpl::setInspectorFrontendProxyToInspectorController):
     17
    1182010-06-09  Yury Semikhatsky  <yurys@chromium.org>
    219
  • trunk/WebKit/chromium/src/InspectorClientImpl.cpp

    r60469 r60889  
    3636#include "NotImplemented.h"
    3737#include "Page.h"
     38#include "WebDevToolsAgentImpl.h"
     39#include "WebDevToolsMessageData.h"
    3840#include "WebRect.h"
    3941#include "WebURL.h"
     
    103105}
    104106
     107bool InspectorClientImpl::sendMessageToFrontend(const WebCore::String& message)
     108{
     109    WebDevToolsAgentImpl* devToolsAgent = static_cast<WebDevToolsAgentImpl*>(m_inspectedWebView->devToolsAgent());
     110    if (!devToolsAgent)
     111        return false;
     112
     113    WebVector<WebString> arguments(size_t(1));
     114    arguments[0] = message;
     115    WebDevToolsMessageData data;
     116    data.className = "ToolsAgentDelegate";
     117    data.methodName = "dispatchOnClient";
     118    data.arguments.swap(arguments);
     119    devToolsAgent->sendRpcMessage(data);
     120    return true;
     121}
     122
    105123} // namespace WebKit
  • trunk/WebKit/chromium/src/InspectorClientImpl.h

    r60469 r60889  
    3737
    3838namespace WebKit {
     39
     40class WebDevToolsAgentClient;
    3941class WebViewImpl;
    4042
     
    4749    virtual void inspectorDestroyed();
    4850    virtual void openInspectorFrontend(WebCore::InspectorController*);
     51
    4952    virtual void highlight(WebCore::Node*);
    5053    virtual void hideHighlight();
    51     virtual void populateSetting(
    52         const WebCore::String& key,
    53         WebCore::String* value);
    54     virtual void storeSetting(
    55         const WebCore::String& key,
    56         const WebCore::String& value);
    5754
     55    virtual void populateSetting(const WebCore::String& key, WebCore::String* value);
     56    virtual void storeSetting(const WebCore::String& key, const WebCore::String& value);
     57
     58    virtual bool sendMessageToFrontend(const WebCore::String&);
    5859private:
    5960
  • trunk/WebKit/chromium/src/WebDevToolsAgentImpl.cpp

    r60436 r60889  
    471471        v8::Local<v8::Context>::New(m_utilityContext));
    472472    InspectorController* ic = inspectorController();
    473     ic->setFrontend(new InspectorFrontend(
    474         ScriptObject(state, m_utilityContext->Global())));
     473    ic->connectFrontend(ScriptObject(state, m_utilityContext->Global()));
    475474}
    476475
  • trunk/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp

    r56051 r60889  
    5959}
    6060
     61bool InspectorClientEfl::sendMessageToFrontend(const String&)
     62{
     63    notImpelemented();
     64    return false;
    6165}
     66
     67
     68}
  • trunk/WebKit/efl/WebCoreSupport/InspectorClientEfl.h

    r56051 r60889  
    5151    virtual void populateSetting(const String& key, String* value);
    5252    virtual void storeSetting(const String& key, const String& value);
     53
     54    virtual bool sendMessageToFrontend(const String&);
    5355};
    5456}
  • trunk/WebKit/gtk/ChangeLog

    r60842 r60889  
     12010-06-07  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
     6        data from inspected page to WebInspector as JSON string via http. The native
     7        serialization to JSON string is supported by InspectorValue's classes. This patch
     8        has the implementation of sendMessageToFrontend function. WebKit version of it still
     9        uses ScriptFunctionCall and will be switched to another transport a little bit later.
     10        https://bugs.webkit.org/show_bug.cgi?id=40134
     11
     12        * WebCoreSupport/InspectorClientGtk.cpp:
     13        (WebKit::InspectorClient::releaseFrontendPage):
     14        (WebKit::InspectorClient::sendMessageToFrontend):
     15        * WebCoreSupport/InspectorClientGtk.h:
     16
    1172010-06-08  Xan Lopez  <xlopez@igalia.com>
    218
  • trunk/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp

    r56825 r60889  
    2020#include "InspectorClientGtk.h"
    2121
     22#include "Frame.h"
    2223#include "webkitwebview.h"
    2324#include "webkitwebinspector.h"
     
    3940InspectorClient::InspectorClient(WebKitWebView* webView)
    4041    : m_inspectedWebView(webView)
     42    , m_frontendPage(0)
    4143{}
    4244
     
    8183    gtk_widget_show(GTK_WIDGET(inspectorWebView));
    8284
    83     Page* inspectorPage = core(inspectorWebView);
    84     inspectorPage->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClient(m_inspectedWebView, inspectorWebView, webInspector, inspectorPage));
     85    m_frontendPage = core(inspectorWebView);
     86    m_frontendPage->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClient(m_inspectedWebView, inspectorWebView, webInspector, m_frontendPage, this));
     87}
     88
     89void InspectorClient::releaseFrontendPage()
     90{
     91    m_frontendPage = 0;
    8592}
    8693
     
    105112}
    106113
     114bool InspectorClient::sendMessageToFrontend(const String& message)
     115{
     116    if (!m_frontendPage)
     117        return false;
     118
     119    Frame* frame = m_frontendPage->mainFrame();
     120    if (!frame)
     121        return false;
     122
     123    ScriptController* scriptController = frame->script();
     124    if (!scriptController)
     125        return false;
     126
     127    String dispatchToFrontend("WebInspector.dispatchMessageToFrontend(");
     128    dispatchToFrontend += message;
     129    dispatchToFrontend += ");";
     130    scriptController->executeScript(dispatchToFrontend);
     131    return true;
     132}
    107133
    108134bool destroyed = TRUE;
    109135
    110 InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, Page* inspectorPage)
     136InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, Page* inspectorPage, InspectorClient* inspectorClient)
    111137    : InspectorFrontendClientLocal(core(inspectedWebView)->inspectorController(), inspectorPage)
    112138    , m_inspectorWebView(inspectorWebView)
    113139    , m_inspectedWebView(inspectedWebView)
    114140    , m_webInspector(webInspector)
     141    , m_inspectorClient(inspectorClient)
    115142{
    116143    g_signal_connect(m_inspectorWebView, "destroy",
     
    138165    g_signal_emit_by_name(webInspector, "close-window", &handled);
    139166    ASSERT(handled);
     167
     168    m_inspectorClient->releaseFrontendPage();
    140169
    141170    /* we should now dispose our own reference */
  • trunk/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h

    r56051 r60889  
    5757        virtual void storeSetting(const WebCore::String& key, const WebCore::String& value);
    5858
     59        virtual bool sendMessageToFrontend(const WebCore::String&);
     60
     61        void releaseFrontendPage();
     62
    5963    private:
    6064        WebKitWebView* m_inspectedWebView;
     65        WebCore::Page* m_frontendPage;
    6166    };
    6267
    6368    class InspectorFrontendClient : public WebCore::InspectorFrontendClientLocal {
    6469    public:
    65         InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, WebCore::Page* inspectorPage);
     70        InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, WebCore::Page* inspectorPage, InspectorClient* inspectorClient);
    6671
    6772        void destroyInspectorWindow();
     
    8792        WebKitWebView* m_inspectedWebView;
    8893        WebKitWebInspector* m_webInspector;
     94        InspectorClient* m_inspectorClient;
    8995    };
    9096}
  • trunk/WebKit/haiku/ChangeLog

    r60463 r60889  
     12010-06-07  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
     6        data from inspected page to WebInspector as JSON string via http. The native
     7        serialization to JSON string is supported by InspectorValue's classes. This patch
     8        has the implementation of sendMessageToFrontend function. WebKit version of it still
     9        uses ScriptFunctionCall and will be switched to another transport a little bit later.
     10        https://bugs.webkit.org/show_bug.cgi?id=40134
     11
     12        * WebCoreSupport/InspectorClientHaiku.cpp:
     13        (WebCore::InspectorClientHaiku::sendMessageToFrontend):
     14        * WebCoreSupport/InspectorClientHaiku.h:
     15
    1162010-05-31  Lyon Chen  <liachen@rim.com>
    217
  • trunk/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.cpp

    r56051 r60889  
    6868}
    6969
     70bool InspectorClientHaiku::sendMessageToFrontend(const String&)
     71{
     72    notImplemented();
     73    return false;
     74}
     75
    7076} // namespace WebCore
    7177
  • trunk/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.h

    r56051 r60889  
    5050        virtual void populateSetting(const WebCore::String& key, WebCore::String* value);
    5151        virtual void storeSetting(const WebCore::String& key, const WebCore::String& value);
     52
     53        virtual bool sendMessageToFrontend(const WebCore::String&);
    5254    };
    5355} // namespace WebCore
  • trunk/WebKit/mac/ChangeLog

    r60882 r60889  
     12010-06-07  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
     6        data from inspected page to WebInspector as JSON string via http. The native
     7        serialization to JSON string is supported by InspectorValue's classes. This patch
     8        has the implementation of sendMessageToFrontend function. WebKit version of it still
     9        uses ScriptFunctionCall and will be switched to another transport a little bit later.
     10        https://bugs.webkit.org/show_bug.cgi?id=40134
     11
     12        * WebCoreSupport/WebInspectorClient.h:
     13        * WebCoreSupport/WebInspectorClient.mm:
     14        (WebInspectorClient::WebInspectorClient):
     15        (WebInspectorClient::openInspectorFrontend):
     16
    1172010-06-08  Mark Rowe  <mrowe@apple.com>
    218
  • trunk/WebKit/mac/WebCoreSupport/WebInspectorClient.h

    r56051 r60889  
    4343#endif
    4444
     45namespace WebCore {
     46
     47class Page;
     48
     49}
     50
    4551class WebInspectorClient : public WebCore::InspectorClient {
    4652public:
     
    5763    virtual void storeSetting(const WebCore::String& key, const WebCore::String& value);
    5864
     65    virtual bool sendMessageToFrontend(const WebCore::String&);
     66
     67    void releaseFrontendPage();
     68
    5969private:
    6070    WebView *m_webView;
    6171    RetainPtr<WebNodeHighlighter> m_highlighter;
     72    WebCore::Page* m_frontendPage;
    6273};
     74
    6375
    6476class WebInspectorFrontendClient : public WebCore::InspectorFrontendClientLocal {
     
    6779
    6880    virtual void frontendLoaded();
    69    
     81
    7082    virtual WebCore::String localizedStringsURL();
    7183    virtual WebCore::String hiddenPanels();
    72    
     84
    7385    virtual void bringToFront();
    7486    virtual void closeWindow();
    75    
     87
    7688    virtual void attachWindow();
    7789    virtual void detachWindow();
    78    
     90
    7991    virtual void setAttachedWindowHeight(unsigned height);
    8092    virtual void inspectedURLChanged(const WebCore::String& newURL);
  • trunk/WebKit/mac/WebCoreSupport/WebInspectorClient.mm

    r59125 r60889  
    5151    WebView *_webView;
    5252    WebInspectorFrontendClient* _frontendClient;
     53    WebInspectorClient* _inspectorClient;
    5354    BOOL _attachedToInspectedWebView;
    5455    BOOL _shouldAttach;
     
    6263- (BOOL)attached;
    6364- (void)setFrontendClient:(WebInspectorFrontendClient*)frontendClient;
     65- (void)setInspectorClient:(WebInspectorClient*)inspectorClient;
    6466- (void)setAttachedWindowHeight:(unsigned)height;
    6567- (void)destroyInspectorView;
     
    8486: m_webView(webView)
    8587, m_highlighter(AdoptNS, [[WebNodeHighlighter alloc] initWithInspectedWebView:webView])
     88, m_frontendPage(0)
    8689{
    8790}
     
    9598{
    9699    RetainPtr<WebInspectorWindowController> windowController(AdoptNS, [[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]);
    97     Page* frontendPage = core([windowController.get() webView]);
    98 
    99     frontendPage->inspectorController()->setInspectorFrontendClient(new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, frontendPage));
     100    [windowController.get() setInspectorClient:this];
     101    m_frontendPage = core([windowController.get() webView]);
     102    m_frontendPage->inspectorController()->setInspectorFrontendClient(new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage));
    100103}
    101104
     
    408411}
    409412
     413- (void)setInspectorClient:(WebInspectorClient*)inspectorClient
     414{
     415    _inspectorClient = inspectorClient;
     416}
     417
    410418- (void)setAttachedWindowHeight:(unsigned)height
    411419{
     
    439447    if (Page* inspectedPage = [_inspectedWebView page])
    440448        inspectedPage->inspectorController()->disconnectFrontend();
     449
     450    _inspectorClient->releaseFrontendPage();
    441451
    442452    [_webView close];
  • trunk/WebKit/qt/ChangeLog

    r60841 r60889  
     12010-06-07  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
     6        data from inspected page to WebInspector as JSON string via http. The native
     7        serialization to JSON string is supported by InspectorValue's classes. This patch
     8        has the implementation of sendMessageToFrontend function. WebKit version of it still
     9        uses ScriptFunctionCall and will be switched to another transport a little bit later.
     10        https://bugs.webkit.org/show_bug.cgi?id=40134
     11
     12        * WebCoreSupport/InspectorClientQt.cpp:
     13        (WebCore::InspectorClientQt::InspectorClientQt):
     14        (WebCore::InspectorClientQt::openInspectorFrontend):
     15        (WebCore::InspectorClientQt::releaseFrontendPage):
     16        (WebCore::InspectorClientQt::sendMessageToFrontend):
     17        * WebCoreSupport/InspectorClientQt.h:
     18
    1192010-06-08  Antonio Gomes  <tonikitoo@webkit.org>
    220
  • trunk/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp

    r60609 r60889  
    3232#include "InspectorClientQt.h"
    3333
     34#include "Frame.h"
    3435#include "qwebinspector.h"
    3536#include "qwebinspector_p.h"
     
    4546#include "Page.h"
    4647#include "PlatformString.h"
     48#include "ScriptController.h"
    4749
    4850namespace WebCore {
     
    7577InspectorClientQt::InspectorClientQt(QWebPage* page)
    7678    : m_inspectedWebPage(page)
     79    , m_frontendWebPage(0)
    7780{}
    7881
     
    104107    inspector->d->setFrontend(inspectorView);
    105108
    106     inspectorView->page()->d->page->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView));
     109    inspectorView->page()->d->page->inspectorController()->setInspectorFrontendClient(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView, this));
     110    m_frontendWebPage = inspectorPage;
     111}
     112
     113void InspectorClientQt::releaseFrontendPage()
     114{
     115    m_frontendWebPage = 0;
    107116}
    108117
     
    161170}
    162171
     172bool InspectorClientQt::sendMessageToFrontend(const String& message)
     173{
     174    if (!m_frontendWebPage)
     175        return false;
     176
     177    Page* frontendPage = QWebPagePrivate::core(m_frontendWebPage);
     178    if (!frontendPage)
     179        return false;
     180
     181    Frame* frame = frontendPage->mainFrame();
     182    if (!frame)
     183        return false;
     184
     185    ScriptController* scriptController = frame->script();
     186    if (!scriptController)
     187        return false;
     188
     189    String dispatchToFrontend("WebInspector.dispatchMessageToFrontend(");
     190    dispatchToFrontend += message;
     191    dispatchToFrontend += ");";
     192    scriptController->executeScript(dispatchToFrontend);
     193    return true;
     194}
     195
    163196static String variantToSetting(const QVariant& qvariant)
    164197{
     
    184217}
    185218
    186 InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView)
     219InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient)
    187220    : InspectorFrontendClientLocal(inspectedWebPage->d->page->inspectorController(), inspectorView->page()->d->page)
    188221    , m_inspectedWebPage(inspectedWebPage)
    189222    , m_inspectorView(inspectorView)
    190223    , m_destroyingInspectorView(false)
     224    , m_inspectorClient(inspectorClient)
    191225{
    192226}
     
    226260    m_inspectedWebPage->d->inspectorController()->disconnectFrontend();
    227261#endif
     262    m_inspectorClient->releaseFrontendPage();
     263
    228264    // Clear pointer before deleting WebView to avoid recursive calls to its destructor.
    229265    delete m_inspectorView.release();
  • trunk/WebKit/qt/WebCoreSupport/InspectorClientQt.h

    r56051 r60889  
    5959    virtual void storeSetting(const String& key, const String& value);
    6060
     61    virtual bool sendMessageToFrontend(const String&);
     62
     63    void releaseFrontendPage();
     64
    6165private:
    6266    QWebPage* m_inspectedWebPage;
     67    QWebPage* m_frontendWebPage;
    6368};
    6469
    6570class InspectorFrontendClientQt : public InspectorFrontendClientLocal {
    6671public:
    67     InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView);
     72    InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient);
    6873
    6974    virtual void frontendLoaded();
     
    8994    QString m_inspectedURL;
    9095    bool m_destroyingInspectorView;
     96    InspectorClientQt* m_inspectorClient;
    9197};
    9298}
  • trunk/WebKit/win/ChangeLog

    r60841 r60889  
     12010-06-07  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
     6        data from inspected page to WebInspector as JSON string via http. The native
     7        serialization to JSON string is supported by InspectorValue's classes. This patch
     8        has the implementation of sendMessageToFrontend function. WebKit version of it still
     9        uses ScriptFunctionCall and will be switched to another transport a little bit later.
     10        https://bugs.webkit.org/show_bug.cgi?id=40134
     11
     12        * WebCoreSupport/WebInspectorClient.cpp:
     13        (WebInspectorClient::WebInspectorClient):
     14        (WebInspectorClient::~WebInspectorClient):
     15        (WebInspectorClient::openInspectorFrontend):
     16        * WebCoreSupport/WebInspectorClient.h:
     17
    1182010-06-08  Antonio Gomes  <tonikitoo@webkit.org>
    219
  • trunk/WebKit/win/WebCoreSupport/WebInspectorClient.cpp

    r58227 r60889  
    7070WebInspectorClient::WebInspectorClient(WebView* webView)
    7171    : m_inspectedWebView(webView)
     72    , m_frontendPage(0)
    7273{
    7374    ASSERT(m_inspectedWebView);
     
    7778WebInspectorClient::~WebInspectorClient()
    7879{
     80    m_frontendPage = 0;
    7981}
    8082
     
    173175        return;
    174176
    175     Page* page = core(frontendWebView.get());
    176     page->inspectorController()->setInspectorFrontendClient(new WebInspectorFrontendClient(m_inspectedWebView, m_inspectedWebViewHwnd, frontendHwnd, frontendWebView, frontendWebViewHwnd, this));
     177    m_frontendPage = core(frontendWebView.get());
     178    WebInspectorFrontendClient* frontendClient = new WebInspectorFrontendClient(m_inspectedWebView, m_inspectedWebViewHwnd, frontendHwnd, frontendWebView, frontendWebViewHwnd, this);
     179    m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient);
    177180    m_frontendHwnd = frontendHwnd;
    178181}
  • trunk/WebKit/win/WebCoreSupport/WebInspectorClient.h

    r58227 r60889  
    3838#include <windows.h>
    3939
     40namespace WebCore {
     41
     42class Page;
     43
     44}
     45
    4046class WebNodeHighlight;
    4147class WebView;
     
    5662    virtual void storeSetting(const WebCore::String& key, const WebCore::String& value);
    5763
     64    virtual bool sendMessageToFrontend(const WebCore::String&);
     65
    5866    void updateHighlight();
    59     void frontendClosing() { m_frontendHwnd = 0; }
     67    void frontendClosing()
     68    {
     69        m_frontendHwnd = 0;
     70        releaseFrontendPage();
     71    }
    6072
     73    void releaseFrontendPage();
    6174private:
    6275    ~WebInspectorClient();
    6376
    6477    WebView* m_inspectedWebView;
     78    WebCore::Page* m_frontendPage;
    6579    HWND m_inspectedWebViewHwnd;
    6680    HWND m_frontendHwnd;
  • trunk/WebKit/wx/ChangeLog

    r60315 r60889  
     12010-06-07  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc
     6        data from inspected page to WebInspector as JSON string via http. The native
     7        serialization to JSON string is supported by InspectorValue's classes. This patch
     8        has the implementation of sendMessageToFrontend function. WebKit version of it still
     9        uses ScriptFunctionCall and will be switched to another transport a little bit later.
     10        https://bugs.webkit.org/show_bug.cgi?id=40134
     11
     12        * WebKitSupport/InspectorClientWx.cpp:
     13        (WebCore::InspectorClientWx::sendMessageToFrontend):
     14        * WebKitSupport/InspectorClientWx.h:
     15
    1162010-05-27  Kevin Ollivier  <kevino@theolliviers.com>
    217
  • trunk/WebKit/wx/WebKitSupport/InspectorClientWx.cpp

    r56309 r60889  
    7373}
    7474
     75bool InspectorClientWx::sendMessageToFrontend(const String&)
     76{
     77    notImplemented();
     78    return false;
     79}
     80
    7581};
  • trunk/WebKit/wx/WebKitSupport/InspectorClientWx.h

    r56051 r60889  
    4949    virtual void populateSetting(const String& key, String* value);
    5050    virtual void storeSetting(const String& key, const String& value);
     51
     52    virtual bool sendMessageToFrontend(const String&);
    5153};
    5254
Note: See TracChangeset for help on using the changeset viewer.