[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
timothy at apple.com
timothy at apple.com
Wed Dec 22 15:22:52 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit c3bef1f5afd5785643320a07a88de39ed3b0fe37
Author: timothy at apple.com <timothy at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 2 15:22:46 2010 +0000
Add WKInspector public APIs.
https://webkit.org/b/48718
Reviewed by Pavel Feldman.
* DerivedSources.make: Added WebInspector to MESSAGE_RECEIVERS section.
* UIProcess/API/C/WKInspector.cpp:
(WKInspectorIsVisible): Added.
(WKInspectorShow): Added.
(WKInspectorClose): Added.
(WKInspectorShowConsole): Added.
(WKInspectorIsAttached): Added.
(WKInspectorAttach): Added.
(WKInspectorDetach): Added.
(WKInspectorIsDebuggingJavaScript): Added.
(WKInspectorToggleJavaScriptDebugging): Added.
(WKInspectorIsProfilingJavaScript): Added.
(WKInspectorToggleJavaScriptProfiling): Added.
(WKInspectorIsProfilingPage): Added.
(WKInspectorTogglePageProfiling): Added.
* UIProcess/API/C/WKInspector.h: Added new functions.
* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::WebInspectorProxy): Initialize new booleans.
(WebKit::WebInspectorProxy::invalidate): Reset new booleans.
(WebKit::WebInspectorProxy::show): Added.
(WebKit::WebInspectorProxy::close): Added.
(WebKit::WebInspectorProxy::showConsole): Added.
(WebKit::WebInspectorProxy::attach): Added.
(WebKit::WebInspectorProxy::detach): Added.
(WebKit::WebInspectorProxy::toggleJavaScriptDebugging): Added.
(WebKit::WebInspectorProxy::toggleJavaScriptProfiling): Added.
(WebKit::WebInspectorProxy::togglePageProfiling): Added.
* UIProcess/WebInspectorProxy.h:
(WebKit::WebInspectorProxy::isVisible): Added.
(WebKit::WebInspectorProxy::isAttached): Added.
(WebKit::WebInspectorProxy::isDebuggingJavaScript): Added.
(WebKit::WebInspectorProxy::isProfilingJavaScript): Added.
(WebKit::WebInspectorProxy::isProfilingPage): Added.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close): Invalidate the WebInspectorProxy.
(WebKit::WebPageProxy::inspector): Return 0 if closed or invalid.
* WebKit2.pro: Added new files.
* WebKit2.xcodeproj/project.pbxproj: Added new Files.
* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::show): Added.
(WebKit::WebInspector::close): Added.
(WebKit::WebInspector::showConsole): Added.
(WebKit::WebInspector::startJavaScriptDebugging): Added.
(WebKit::WebInspector::stopJavaScriptDebugging): Added.
(WebKit::WebInspector::startJavaScriptProfiling): Added.
(WebKit::WebInspector::stopJavaScriptProfiling): Added.
(WebKit::WebInspector::startPageProfiling): Added.
(WebKit::WebInspector::stopPageProfiling): Added.
* WebProcess/WebPage/WebInspector.h:
(WebKit::WebInspector::page): Added.
* WebProcess/WebPage/WebInspector.messages.in: Added.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::close): Destroy the WebInspector.
(WebKit::WebPage::inspector): Return 0 if closed.
(WebKit::WebPage::didReceiveMessage): Send the message to the WebInspector
if the message class is MessageClassWebInspector.
* win/WebKit2.vcproj: Added new files.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71115 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 1072803..02eb3a3 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,71 @@
2010-11-02 Timothy Hatcher <timothy at apple.com>
+ Add WKInspector public APIs.
+
+ https://webkit.org/b/48718
+
+ Reviewed by Pavel Feldman.
+
+ * DerivedSources.make: Added WebInspector to MESSAGE_RECEIVERS section.
+ * UIProcess/API/C/WKInspector.cpp:
+ (WKInspectorIsVisible): Added.
+ (WKInspectorShow): Added.
+ (WKInspectorClose): Added.
+ (WKInspectorShowConsole): Added.
+ (WKInspectorIsAttached): Added.
+ (WKInspectorAttach): Added.
+ (WKInspectorDetach): Added.
+ (WKInspectorIsDebuggingJavaScript): Added.
+ (WKInspectorToggleJavaScriptDebugging): Added.
+ (WKInspectorIsProfilingJavaScript): Added.
+ (WKInspectorToggleJavaScriptProfiling): Added.
+ (WKInspectorIsProfilingPage): Added.
+ (WKInspectorTogglePageProfiling): Added.
+ * UIProcess/API/C/WKInspector.h: Added new functions.
+ * UIProcess/WebInspectorProxy.cpp:
+ (WebKit::WebInspectorProxy::WebInspectorProxy): Initialize new booleans.
+ (WebKit::WebInspectorProxy::invalidate): Reset new booleans.
+ (WebKit::WebInspectorProxy::show): Added.
+ (WebKit::WebInspectorProxy::close): Added.
+ (WebKit::WebInspectorProxy::showConsole): Added.
+ (WebKit::WebInspectorProxy::attach): Added.
+ (WebKit::WebInspectorProxy::detach): Added.
+ (WebKit::WebInspectorProxy::toggleJavaScriptDebugging): Added.
+ (WebKit::WebInspectorProxy::toggleJavaScriptProfiling): Added.
+ (WebKit::WebInspectorProxy::togglePageProfiling): Added.
+ * UIProcess/WebInspectorProxy.h:
+ (WebKit::WebInspectorProxy::isVisible): Added.
+ (WebKit::WebInspectorProxy::isAttached): Added.
+ (WebKit::WebInspectorProxy::isDebuggingJavaScript): Added.
+ (WebKit::WebInspectorProxy::isProfilingJavaScript): Added.
+ (WebKit::WebInspectorProxy::isProfilingPage): Added.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::close): Invalidate the WebInspectorProxy.
+ (WebKit::WebPageProxy::inspector): Return 0 if closed or invalid.
+ * WebKit2.pro: Added new files.
+ * WebKit2.xcodeproj/project.pbxproj: Added new Files.
+ * WebProcess/WebPage/WebInspector.cpp:
+ (WebKit::WebInspector::show): Added.
+ (WebKit::WebInspector::close): Added.
+ (WebKit::WebInspector::showConsole): Added.
+ (WebKit::WebInspector::startJavaScriptDebugging): Added.
+ (WebKit::WebInspector::stopJavaScriptDebugging): Added.
+ (WebKit::WebInspector::startJavaScriptProfiling): Added.
+ (WebKit::WebInspector::stopJavaScriptProfiling): Added.
+ (WebKit::WebInspector::startPageProfiling): Added.
+ (WebKit::WebInspector::stopPageProfiling): Added.
+ * WebProcess/WebPage/WebInspector.h:
+ (WebKit::WebInspector::page): Added.
+ * WebProcess/WebPage/WebInspector.messages.in: Added.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::close): Destroy the WebInspector.
+ (WebKit::WebPage::inspector): Return 0 if closed.
+ (WebKit::WebPage::didReceiveMessage): Send the message to the WebInspector
+ if the message class is MessageClassWebInspector.
+ * win/WebKit2.vcproj: Added new files.
+
+2010-11-02 Timothy Hatcher <timothy at apple.com>
+
Make WebInspectorFrontendClient inherit from InspectorFrontendClientLocal.
We can do this since the Web Inspector WebPage will share the same process
diff --git a/WebKit2/DerivedSources.make b/WebKit2/DerivedSources.make
index f195a21..8eaabc6 100644
--- a/WebKit2/DerivedSources.make
+++ b/WebKit2/DerivedSources.make
@@ -14,6 +14,7 @@ MESSAGE_RECEIVERS = \
PluginProcess \
PluginProcessProxy \
PluginProxy \
+ WebInspector \
WebPage \
WebPageProxy \
WebProcess \
diff --git a/WebKit2/UIProcess/API/C/WKInspector.cpp b/WebKit2/UIProcess/API/C/WKInspector.cpp
index 2f11b78..803036a 100644
--- a/WebKit2/UIProcess/API/C/WKInspector.cpp
+++ b/WebKit2/UIProcess/API/C/WKInspector.cpp
@@ -39,3 +39,68 @@ WKPageRef WKInspectorGetPage(WKInspectorRef inspectorRef)
{
return toAPI(toImpl(inspectorRef)->page());
}
+
+bool WKInspectorIsVisible(WKInspectorRef inspectorRef)
+{
+ return toImpl(inspectorRef)->isVisible();
+}
+
+void WKInspectorShow(WKInspectorRef inspectorRef)
+{
+ toImpl(inspectorRef)->show();
+}
+
+void WKInspectorClose(WKInspectorRef inspectorRef)
+{
+ toImpl(inspectorRef)->close();
+}
+
+void WKInspectorShowConsole(WKInspectorRef inspectorRef)
+{
+ toImpl(inspectorRef)->showConsole();
+}
+
+bool WKInspectorIsAttached(WKInspectorRef inspectorRef)
+{
+ return toImpl(inspectorRef)->isAttached();
+}
+
+void WKInspectorAttach(WKInspectorRef inspectorRef)
+{
+ toImpl(inspectorRef)->attach();
+}
+
+void WKInspectorDetach(WKInspectorRef inspectorRef)
+{
+ toImpl(inspectorRef)->detach();
+}
+
+bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspectorRef)
+{
+ return toImpl(inspectorRef)->isDebuggingJavaScript();
+}
+
+void WKInspectorToggleJavaScriptDebugging(WKInspectorRef inspectorRef)
+{
+ toImpl(inspectorRef)->toggleJavaScriptDebugging();
+}
+
+bool WKInspectorIsProfilingJavaScript(WKInspectorRef inspectorRef)
+{
+ return toImpl(inspectorRef)->isProfilingJavaScript();
+}
+
+void WKInspectorToggleJavaScriptProfiling(WKInspectorRef inspectorRef)
+{
+ toImpl(inspectorRef)->toggleJavaScriptProfiling();
+}
+
+bool WKInspectorIsProfilingPage(WKInspectorRef inspectorRef)
+{
+ return toImpl(inspectorRef)->isProfilingPage();
+}
+
+void WKInspectorTogglePageProfiling(WKInspectorRef inspectorRef)
+{
+ toImpl(inspectorRef)->togglePageProfiling();
+}
diff --git a/WebKit2/UIProcess/API/C/WKInspector.h b/WebKit2/UIProcess/API/C/WKInspector.h
index 8009ff1..f950e7e 100644
--- a/WebKit2/UIProcess/API/C/WKInspector.h
+++ b/WebKit2/UIProcess/API/C/WKInspector.h
@@ -40,6 +40,25 @@ WK_EXPORT WKTypeID WKInspectorGetTypeID();
WK_EXPORT WKPageRef WKInspectorGetPage(WKInspectorRef inspector);
+WK_EXPORT bool WKInspectorIsVisible(WKInspectorRef inspector);
+WK_EXPORT void WKInspectorShow(WKInspectorRef inspector);
+WK_EXPORT void WKInspectorClose(WKInspectorRef inspector);
+
+WK_EXPORT void WKInspectorShowConsole(WKInspectorRef inspector);
+
+WK_EXPORT bool WKInspectorIsAttached(WKInspectorRef inspector);
+WK_EXPORT void WKInspectorAttach(WKInspectorRef inspector);
+WK_EXPORT void WKInspectorDetach(WKInspectorRef inspector);
+
+WK_EXPORT bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspector);
+WK_EXPORT void WKInspectorToggleJavaScriptDebugging(WKInspectorRef inspector);
+
+WK_EXPORT bool WKInspectorIsProfilingJavaScript(WKInspectorRef inspector);
+WK_EXPORT void WKInspectorToggleJavaScriptProfiling(WKInspectorRef inspector);
+
+WK_EXPORT bool WKInspectorIsProfilingPage(WKInspectorRef inspector);
+WK_EXPORT void WKInspectorTogglePageProfiling(WKInspectorRef inspector);
+
#ifdef __cplusplus
}
#endif
diff --git a/WebKit2/UIProcess/WebInspectorProxy.cpp b/WebKit2/UIProcess/WebInspectorProxy.cpp
index 3f3ab12..cfef786 100644
--- a/WebKit2/UIProcess/WebInspectorProxy.cpp
+++ b/WebKit2/UIProcess/WebInspectorProxy.cpp
@@ -25,7 +25,12 @@
#include "WebInspectorProxy.h"
+#include "WebInspectorMessages.h"
#include "WebPageProxy.h"
+#include "WebProcessProxy.h"
+
+#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
+#include "NotImplemented.h"
using namespace WebCore;
@@ -33,6 +38,11 @@ namespace WebKit {
WebInspectorProxy::WebInspectorProxy(WebPageProxy* page)
: m_page(page)
+ , m_isVisible(false)
+ , m_isAttached(false)
+ , m_isDebuggingJavaScript(false)
+ , m_isProfilingJavaScript(false)
+ , m_isProfilingPage(false)
{
}
@@ -43,6 +53,86 @@ WebInspectorProxy::~WebInspectorProxy()
void WebInspectorProxy::invalidate()
{
m_page = 0;
+ m_isDebuggingJavaScript = false;
+ m_isProfilingJavaScript = false;
+ m_isProfilingPage = false;
+}
+
+// Public APIs
+void WebInspectorProxy::show()
+{
+ if (!m_page)
+ return;
+
+ m_page->process()->send(Messages::WebInspector::Show(), m_page->pageID());
+}
+
+void WebInspectorProxy::close()
+{
+ if (!m_page)
+ return;
+
+ m_page->process()->send(Messages::WebInspector::Close(), m_page->pageID());
+}
+
+void WebInspectorProxy::showConsole()
+{
+ if (!m_page)
+ return;
+
+ m_page->process()->send(Messages::WebInspector::ShowConsole(), m_page->pageID());
+}
+
+void WebInspectorProxy::attach()
+{
+ notImplemented();
+}
+
+void WebInspectorProxy::detach()
+{
+ notImplemented();
+}
+
+void WebInspectorProxy::toggleJavaScriptDebugging()
+{
+ if (!m_page)
+ return;
+
+ if (m_isDebuggingJavaScript)
+ m_page->process()->send(Messages::WebInspector::StopJavaScriptDebugging(), m_page->pageID());
+ else
+ m_page->process()->send(Messages::WebInspector::StartJavaScriptDebugging(), m_page->pageID());
+
+ // FIXME: have the WebProcess notify us on state changes.
+ m_isDebuggingJavaScript = !m_isDebuggingJavaScript;
+}
+
+void WebInspectorProxy::toggleJavaScriptProfiling()
+{
+ if (!m_page)
+ return;
+
+ if (m_isProfilingJavaScript)
+ m_page->process()->send(Messages::WebInspector::StopJavaScriptProfiling(), m_page->pageID());
+ else
+ m_page->process()->send(Messages::WebInspector::StartJavaScriptProfiling(), m_page->pageID());
+
+ // FIXME: have the WebProcess notify us on state changes.
+ m_isProfilingJavaScript = !m_isProfilingJavaScript;
+}
+
+void WebInspectorProxy::togglePageProfiling()
+{
+ if (!m_page)
+ return;
+
+ if (m_isProfilingPage)
+ m_page->process()->send(Messages::WebInspector::StopPageProfiling(), m_page->pageID());
+ else
+ m_page->process()->send(Messages::WebInspector::StartPageProfiling(), m_page->pageID());
+
+ // FIXME: have the WebProcess notify us on state changes.
+ m_isProfilingPage = !m_isProfilingPage;
}
} // namespace WebKit
diff --git a/WebKit2/UIProcess/WebInspectorProxy.h b/WebKit2/UIProcess/WebInspectorProxy.h
index c08f11b..9141136 100644
--- a/WebKit2/UIProcess/WebInspectorProxy.h
+++ b/WebKit2/UIProcess/WebInspectorProxy.h
@@ -47,14 +47,40 @@ public:
void invalidate();
+ // Public APIs
WebPageProxy* page() { return m_page; }
+ bool isVisible() const { return m_isVisible; }
+ void show();
+ void close();
+
+ void showConsole();
+
+ bool isAttached() const { return m_isAttached; }
+ void attach();
+ void detach();
+
+ bool isDebuggingJavaScript() const { return m_isDebuggingJavaScript; }
+ void toggleJavaScriptDebugging();
+
+ bool isProfilingJavaScript() const { return m_isProfilingJavaScript; }
+ void toggleJavaScriptProfiling();
+
+ bool isProfilingPage() const { return m_isProfilingPage; }
+ void togglePageProfiling();
+
private:
WebInspectorProxy(WebPageProxy* page);
virtual Type type() const { return APIType; }
WebPageProxy* m_page;
+
+ bool m_isVisible;
+ bool m_isAttached;
+ bool m_isDebuggingJavaScript;
+ bool m_isProfilingJavaScript;
+ bool m_isProfilingPage;
};
} // namespace WebKit
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index c91bc00..23a6489 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -193,6 +193,12 @@ void WebPageProxy::close()
m_mainFrame = 0;
m_customUserAgent = String();
+
+ if (m_inspector) {
+ m_inspector->invalidate();
+ m_inspector = 0;
+ }
+
m_pageTitle = String();
m_toolTip = String();
@@ -1036,6 +1042,8 @@ void WebPageProxy::didDraw()
WebInspectorProxy* WebPageProxy::inspector()
{
+ if (isClosed() || !isValid())
+ return 0;
if (!m_inspector)
m_inspector = WebInspectorProxy::create(this);
return m_inspector.get();
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index 034a48c..0f11c57 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -148,6 +148,7 @@ WEBKIT2_GENERATED_HEADERS = \
$$OUTPUT_DIR/WebKit2/generated/PluginProcessMessages.h \
$$OUTPUT_DIR/WebKit2/generated/PluginProcessProxyMessages.h \
$$OUTPUT_DIR/WebKit2/generated/PluginProxyMessages.h \
+ $$OUTPUT_DIR/WebKit2/generated/WebInspectorMessages.h \
$$OUTPUT_DIR/WebKit2/generated/WebPageMessages.h \
$$OUTPUT_DIR/WebKit2/generated/WebPageProxyMessages.h \
$$OUTPUT_DIR/WebKit2/generated/WebProcessConnectionMessages.h \
@@ -158,6 +159,7 @@ WEBKIT2_GENERATED_SOURCES = \
$$OUTPUT_DIR/WebKit2/generated/PluginProcessMessageReceiver.cpp \
$$OUTPUT_DIR/WebKit2/generated/PluginProcessProxyMessageReceiver.cpp \
$$OUTPUT_DIR/WebKit2/generated/PluginProxyMessageReceiver.cpp \
+ $$OUTPUT_DIR/WebKit2/generated/WebInspectorMessageReceiver.cpp \
$$OUTPUT_DIR/WebKit2/generated/WebPageMessageReceiver.cpp \
$$OUTPUT_DIR/WebKit2/generated/WebPageProxyMessageReceiver.cpp \
$$OUTPUT_DIR/WebKit2/generated/WebProcessConnectionMessageReceiver.cpp \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index ca10292..27b4fb8 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -171,8 +171,10 @@
1C8E28211275D15400BC7BD0 /* WebInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E281F1275D15400BC7BD0 /* WebInspector.cpp */; };
1C8E28341275D73800BC7BD0 /* WebInspectorProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8E28321275D73800BC7BD0 /* WebInspectorProxy.h */; };
1C8E28351275D73800BC7BD0 /* WebInspectorProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E28331275D73800BC7BD0 /* WebInspectorProxy.cpp */; };
- 1C8E293912761E5B00BC7BD0 /* WKInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8E293712761E5B00BC7BD0 /* WKInspector.h */; };
+ 1C8E293912761E5B00BC7BD0 /* WKInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8E293712761E5B00BC7BD0 /* WKInspector.h */; settings = {ATTRIBUTES = (Public, ); }; };
1C8E293A12761E5B00BC7BD0 /* WKInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E293812761E5B00BC7BD0 /* WKInspector.cpp */; };
+ 1C8E2A351277852400BC7BD0 /* WebInspectorMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C8E2A311277852400BC7BD0 /* WebInspectorMessageReceiver.cpp */; };
+ 1C8E2A361277852400BC7BD0 /* WebInspectorMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8E2A321277852400BC7BD0 /* WebInspectorMessages.h */; };
51578B831209ECEF00A37C4A /* WebData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51578B821209ECEF00A37C4A /* WebData.h */; };
516A4A5D120A2CCD00C05B7F /* WebError.h in Headers */ = {isa = PBXBuildFile; fileRef = 516A4A5B120A2CCD00C05B7F /* WebError.h */; };
51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51871B59127CB89D00F76232 /* WebContextMenu.cpp */; };
@@ -693,6 +695,9 @@
1C8E28331275D73800BC7BD0 /* WebInspectorProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorProxy.cpp; sourceTree = "<group>"; };
1C8E293712761E5B00BC7BD0 /* WKInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKInspector.h; sourceTree = "<group>"; };
1C8E293812761E5B00BC7BD0 /* WKInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKInspector.cpp; sourceTree = "<group>"; };
+ 1C8E2A1C1277833F00BC7BD0 /* WebInspector.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebInspector.messages.in; sourceTree = "<group>"; };
+ 1C8E2A311277852400BC7BD0 /* WebInspectorMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorMessageReceiver.cpp; sourceTree = "<group>"; };
+ 1C8E2A321277852400BC7BD0 /* WebInspectorMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebInspectorMessages.h; sourceTree = "<group>"; };
32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2Prefix.h; sourceTree = "<group>"; };
51578B821209ECEF00A37C4A /* WebData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebData.h; sourceTree = "<group>"; };
516A4A5B120A2CCD00C05B7F /* WebError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebError.h; sourceTree = "<group>"; };
@@ -1515,6 +1520,7 @@
BC032D8910F437A00058C15A /* WebFrame.h */,
1C8E281F1275D15400BC7BD0 /* WebInspector.cpp */,
1C8E281E1275D15400BC7BD0 /* WebInspector.h */,
+ 1C8E2A1C1277833F00BC7BD0 /* WebInspector.messages.in */,
BC963D6A113DD19200574BE2 /* WebPage.cpp */,
BC032D8B10F437A00058C15A /* WebPage.h */,
C0CE72581247E4DA00BC0EC4 /* WebPage.messages.in */,
@@ -1989,6 +1995,8 @@
1A043B5C124D5E9D00FFBFB5 /* PluginProcessProxyMessages.h */,
1A8EFA6E1252B84100F7067F /* PluginProxyMessageReceiver.cpp */,
1A8EFA6F1252B84100F7067F /* PluginProxyMessages.h */,
+ 1C8E2A311277852400BC7BD0 /* WebInspectorMessageReceiver.cpp */,
+ 1C8E2A321277852400BC7BD0 /* WebInspectorMessages.h */,
C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */,
C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */,
BCBD3912125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp */,
@@ -2271,6 +2279,7 @@
1A2D843A127F65D5001EB962 /* NPObjectMessageReceiverMessages.h in Headers */,
1A2D848B127F6A49001EB962 /* NPIdentifierData.h in Headers */,
1A2D84A3127F6AD1001EB962 /* NPVariantData.h in Headers */,
+ 1C8E2A361277852400BC7BD0 /* WebInspectorMessages.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2608,6 +2617,7 @@
1A2D8439127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp in Sources */,
1A2D848C127F6A49001EB962 /* NPIdentifierData.cpp in Sources */,
1A2D84A4127F6AD1001EB962 /* NPVariantData.cpp in Sources */,
+ 1C8E2A351277852400BC7BD0 /* WebInspectorMessageReceiver.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKit2/WebProcess/WebPage/WebInspector.cpp b/WebKit2/WebProcess/WebPage/WebInspector.cpp
index 0e6e517..c97ae08 100644
--- a/WebKit2/WebProcess/WebPage/WebInspector.cpp
+++ b/WebKit2/WebProcess/WebPage/WebInspector.cpp
@@ -26,6 +26,8 @@
#include "WebInspector.h"
#include "WebPage.h"
+#include <WebCore/InspectorController.h>
+#include <WebCore/Page.h>
using namespace WebCore;
@@ -36,4 +38,53 @@ WebInspector::WebInspector(WebPage* page)
{
}
+// Called by WebInspector messages
+void WebInspector::show()
+{
+ m_page->corePage()->inspectorController()->show();
+}
+
+void WebInspector::close()
+{
+ m_page->corePage()->inspectorController()->close();
+}
+
+void WebInspector::showConsole()
+{
+ m_page->corePage()->inspectorController()->showPanel(InspectorController::ConsolePanel);
+}
+
+void WebInspector::startJavaScriptDebugging()
+{
+ m_page->corePage()->inspectorController()->showPanel(InspectorController::ScriptsPanel);
+ m_page->corePage()->inspectorController()->enableDebugger();
+}
+
+void WebInspector::stopJavaScriptDebugging()
+{
+ m_page->corePage()->inspectorController()->disableDebugger();
+}
+
+void WebInspector::startJavaScriptProfiling()
+{
+ m_page->corePage()->inspectorController()->startUserInitiatedProfiling();
+}
+
+void WebInspector::stopJavaScriptProfiling()
+{
+ m_page->corePage()->inspectorController()->stopUserInitiatedProfiling();
+ m_page->corePage()->inspectorController()->showPanel(InspectorController::ProfilesPanel);
+}
+
+void WebInspector::startPageProfiling()
+{
+ m_page->corePage()->inspectorController()->startTimelineProfiler();
+}
+
+void WebInspector::stopPageProfiling()
+{
+ m_page->corePage()->inspectorController()->stopTimelineProfiler();
+ // FIXME: show the Timeline panel.
+}
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/WebInspector.h b/WebKit2/WebProcess/WebPage/WebInspector.h
index 2148d3e..ff99853 100644
--- a/WebKit2/WebProcess/WebPage/WebInspector.h
+++ b/WebKit2/WebProcess/WebPage/WebInspector.h
@@ -40,7 +40,27 @@ class WebInspector {
public:
explicit WebInspector(WebPage*);
+ WebPage* page() const { return m_page; }
+
+ // Implemented in generated WebInspectorMessageReceiver.cpp
+ void didReceiveWebInspectorMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
private:
+ // Called by WebInspector messages
+ void show();
+ void close();
+
+ void showConsole();
+
+ void startJavaScriptDebugging();
+ void stopJavaScriptDebugging();
+
+ void startJavaScriptProfiling();
+ void stopJavaScriptProfiling();
+
+ void startPageProfiling();
+ void stopPageProfiling();
+
WebPage* m_page;
};
diff --git a/WebKit2/WebProcess/WebPage/WebInspector.messages.in b/WebKit2/WebProcess/WebPage/WebInspector.messages.in
new file mode 100644
index 0000000..7d7745d
--- /dev/null
+++ b/WebKit2/WebProcess/WebPage/WebInspector.messages.in
@@ -0,0 +1,33 @@
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> WebInspector {
+ Show()
+ Close()
+ ShowConsole()
+ StartJavaScriptDebugging()
+ StopJavaScriptDebugging()
+ StartJavaScriptProfiling()
+ StopJavaScriptProfiling()
+ StartPageProfiling()
+ StopPageProfiling()
+}
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index d77dac2..1665f45 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -280,6 +280,8 @@ void WebPage::close()
if (WebProcess::shared().injectedBundle())
WebProcess::shared().injectedBundle()->willDestroyPage(this);
+ m_inspector = 0;
+
if (m_activePopupMenu) {
m_activePopupMenu->disconnectFromPage();
m_activePopupMenu = 0;
@@ -800,6 +802,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
WebInspector* WebPage::inspector()
{
+ if (m_isClosed)
+ return 0;
if (!m_inspector)
m_inspector = adoptPtr(new WebInspector(this));
return m_inspector.get();
@@ -961,6 +965,12 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
return;
}
+ if (messageID.is<CoreIPC::MessageClassWebInspector>()) {
+ if (WebInspector* inspector = this->inspector())
+ inspector->didReceiveWebInspectorMessage(connection, messageID, arguments);
+ return;
+ }
+
didReceiveWebPageMessage(connection, messageID, arguments);
}
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index ccd3e95..d621bec 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -1228,6 +1228,10 @@
>
</File>
<File
+ RelativePath="..\WebProcess\WebPage\WebInspector.messages.in"
+ >
+ </File>
+ <File
RelativePath="..\WebProcess\WebPage\WebPage.cpp"
>
</File>
@@ -2393,6 +2397,14 @@
Name="Derived Sources"
>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\WebInspectorMessageReceiver.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\WebInspectorMessages.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\WebPageMessageReceiver.cpp"
>
</File>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list