[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
yutak at chromium.org
yutak at chromium.org
Wed Dec 22 14:49:14 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 9769933fd361922589d4b4bdd1a1ca046cabddd1
Author: yutak at chromium.org <yutak at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 21 09:23:39 2010 +0000
2010-10-21 Yuta Kitamura <yutak at chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: Handle WebSocket events via InspectorInstrumentation
https://bugs.webkit.org/show_bug.cgi?id=47968
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didCreateWebSocketImpl):
(WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl):
(WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl):
(WebCore::InspectorInstrumentation::didCloseWebSocketImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didCreateWebSocket):
(WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest):
(WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse):
(WebCore::InspectorInstrumentation::didCloseWebSocket):
* websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::WebSocketChannel):
Now we do not depend on InspectorController to generate a resource identifier.
(WebCore::WebSocketChannel::disconnect):
Check if m_identifier is valid in case we could not obtain an identifier.
(WebCore::WebSocketChannel::didOpen):
(WebCore::WebSocketChannel::didClose):
(WebCore::WebSocketChannel::processBuffer):
* websockets/WebSocketChannel.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8049e6b..2c5f2bc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-10-21 Yuta Kitamura <yutak at chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: Handle WebSocket events via InspectorInstrumentation
+ https://bugs.webkit.org/show_bug.cgi?id=47968
+
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::didCreateWebSocketImpl):
+ (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl):
+ (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl):
+ (WebCore::InspectorInstrumentation::didCloseWebSocketImpl):
+ * inspector/InspectorInstrumentation.h:
+ (WebCore::InspectorInstrumentation::didCreateWebSocket):
+ (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest):
+ (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse):
+ (WebCore::InspectorInstrumentation::didCloseWebSocket):
+ * websockets/WebSocketChannel.cpp:
+ (WebCore::WebSocketChannel::WebSocketChannel):
+ Now we do not depend on InspectorController to generate a resource identifier.
+ (WebCore::WebSocketChannel::disconnect):
+ Check if m_identifier is valid in case we could not obtain an identifier.
+ (WebCore::WebSocketChannel::didOpen):
+ (WebCore::WebSocketChannel::didClose):
+ (WebCore::WebSocketChannel::processBuffer):
+ * websockets/WebSocketChannel.h:
+
2010-10-20 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/WebCore/inspector/InspectorInstrumentation.cpp b/WebCore/inspector/InspectorInstrumentation.cpp
index ae89266..94202c1 100644
--- a/WebCore/inspector/InspectorInstrumentation.cpp
+++ b/WebCore/inspector/InspectorInstrumentation.cpp
@@ -412,6 +412,28 @@ void InspectorInstrumentation::didWriteHTMLImpl(const InspectorInstrumentationCo
timelineAgent->didWriteHTML(endLine);
}
+#if ENABLE(WEB_SOCKETS)
+void InspectorInstrumentation::didCreateWebSocketImpl(InspectorController* inspectorController, unsigned long identifier, const KURL& requestURL, const KURL& documentURL)
+{
+ inspectorController->didCreateWebSocket(identifier, requestURL, documentURL);
+}
+
+void InspectorInstrumentation::willSendWebSocketHandshakeRequestImpl(InspectorController* inspectorController, unsigned long identifier, const WebSocketHandshakeRequest& request)
+{
+ inspectorController->willSendWebSocketHandshakeRequest(identifier, request);
+}
+
+void InspectorInstrumentation::didReceiveWebSocketHandshakeResponseImpl(InspectorController* inspectorController, unsigned long identifier, const WebSocketHandshakeResponse& response)
+{
+ inspectorController->didReceiveWebSocketHandshakeResponse(identifier, response);
+}
+
+void InspectorInstrumentation::didCloseWebSocketImpl(InspectorController* inspectorController, unsigned long identifier)
+{
+ inspectorController->didCloseWebSocket(identifier);
+}
+#endif
+
bool InspectorInstrumentation::hasFrontend(InspectorController* inspectorController)
{
return inspectorController->hasFrontend();
diff --git a/WebCore/inspector/InspectorInstrumentation.h b/WebCore/inspector/InspectorInstrumentation.h
index e728a5e..1b62ecb 100644
--- a/WebCore/inspector/InspectorInstrumentation.h
+++ b/WebCore/inspector/InspectorInstrumentation.h
@@ -42,11 +42,17 @@ class CharacterData;
class Element;
class InspectorController;
class InspectorTimelineAgent;
+class KURL;
class Node;
class ResourceRequest;
class ResourceResponse;
class XMLHttpRequest;
+#if ENABLE(WEB_SOCKETS)
+class WebSocketHandshakeRequest;
+class WebSocketHandshakeResponse;
+#endif
+
typedef pair<InspectorController*, int> InspectorInstrumentationCookie;
class InspectorInstrumentation {
@@ -90,6 +96,13 @@ public:
static InspectorInstrumentationCookie willWriteHTML(Document*, unsigned int length, unsigned int startLine);
static void didWriteHTML(const InspectorInstrumentationCookie&, unsigned int endLine);
+#if ENABLE(WEB_SOCKETS)
+ static void didCreateWebSocket(ScriptExecutionContext*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
+ static void willSendWebSocketHandshakeRequest(ScriptExecutionContext*, unsigned long identifier, const WebSocketHandshakeRequest&);
+ static void didReceiveWebSocketHandshakeResponse(ScriptExecutionContext*, unsigned long identifier, const WebSocketHandshakeResponse&);
+ static void didCloseWebSocket(ScriptExecutionContext*, unsigned long identifier);
+#endif
+
#if ENABLE(INSPECTOR)
static void frontendCreated() { s_frontendCounter += 1; }
static void frontendDeleted() { s_frontendCounter -= 1; }
@@ -140,6 +153,13 @@ private:
static InspectorInstrumentationCookie willWriteHTMLImpl(InspectorController*, unsigned int length, unsigned int startLine);
static void didWriteHTMLImpl(const InspectorInstrumentationCookie&, unsigned int endLine);
+#if ENABLE(WEB_SOCKETS)
+ static void didCreateWebSocketImpl(InspectorController*, unsigned long identifier, const KURL& requestURL, const KURL& documentURL);
+ static void willSendWebSocketHandshakeRequestImpl(InspectorController*, unsigned long identifier, const WebSocketHandshakeRequest&);
+ static void didReceiveWebSocketHandshakeResponseImpl(InspectorController*, unsigned long identifier, const WebSocketHandshakeResponse&);
+ static void didCloseWebSocketImpl(InspectorController*, unsigned long identifier);
+#endif
+
static InspectorController* inspectorControllerForContext(ScriptExecutionContext*);
static InspectorController* inspectorControllerForDocument(Document*);
static InspectorController* inspectorControllerForFrame(Frame*);
@@ -460,6 +480,39 @@ inline void InspectorInstrumentation::didWriteHTML(const InspectorInstrumentatio
#endif
}
+#if ENABLE(WEB_SOCKETS)
+inline void InspectorInstrumentation::didCreateWebSocket(ScriptExecutionContext* context, unsigned long identifier, const KURL& requestURL, const KURL& documentURL)
+{
+#if ENABLE(INSPECTOR)
+ if (InspectorController* inspectorController = inspectorControllerForContext(context))
+ didCreateWebSocketImpl(inspectorController, identifier, requestURL, documentURL);
+#endif
+}
+
+inline void InspectorInstrumentation::willSendWebSocketHandshakeRequest(ScriptExecutionContext* context, unsigned long identifier, const WebSocketHandshakeRequest& request)
+{
+#if ENABLE(INSPECTOR)
+ if (InspectorController* inspectorController = inspectorControllerForContext(context))
+ willSendWebSocketHandshakeRequestImpl(inspectorController, identifier, request);
+#endif
+}
+
+inline void InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(ScriptExecutionContext* context, unsigned long identifier, const WebSocketHandshakeResponse& response)
+{
+#if ENABLE(INSPECTOR)
+ if (InspectorController* inspectorController = inspectorControllerForContext(context))
+ didReceiveWebSocketHandshakeResponseImpl(inspectorController, identifier, response);
+#endif
+}
+
+inline void InspectorInstrumentation::didCloseWebSocket(ScriptExecutionContext* context, unsigned long identifier)
+{
+#if ENABLE(INSPECTOR)
+ if (InspectorController* inspectorController = inspectorControllerForContext(context))
+ didCloseWebSocketImpl(inspectorController, identifier);
+#endif
+}
+#endif
#if ENABLE(INSPECTOR)
inline InspectorController* InspectorInstrumentation::inspectorControllerForContext(ScriptExecutionContext* context)
diff --git a/WebCore/websockets/WebSocketChannel.cpp b/WebCore/websockets/WebSocketChannel.cpp
index 45bb206..01c2bef 100644
--- a/WebCore/websockets/WebSocketChannel.cpp
+++ b/WebCore/websockets/WebSocketChannel.cpp
@@ -36,7 +36,7 @@
#include "CookieJar.h"
#include "Document.h"
-#include "InspectorController.h"
+#include "InspectorInstrumentation.h"
#include "Logging.h"
#include "Page.h"
#include "PlatformString.h"
@@ -67,14 +67,14 @@ WebSocketChannel::WebSocketChannel(ScriptExecutionContext* context, WebSocketCha
, m_closed(false)
, m_shouldDiscardReceivedData(false)
, m_unhandledBufferedAmount(0)
-#if ENABLE(INSPECTOR)
, m_identifier(0)
-#endif
{
-#if ENABLE(INSPECTOR)
- if (InspectorController* controller = m_context->inspectorController())
- controller->didCreateWebSocket(identifier(), url, m_context->url());
-#endif
+ if (m_context->isDocument())
+ if (Page* page = static_cast<Document*>(m_context)->page())
+ m_identifier = page->progress()->createUniqueIdentifier();
+
+ if (m_identifier)
+ InspectorInstrumentation::didCreateWebSocket(m_context, m_identifier, url, m_context->url());
}
WebSocketChannel::~WebSocketChannel()
@@ -124,11 +124,8 @@ void WebSocketChannel::close()
void WebSocketChannel::disconnect()
{
LOG(Network, "WebSocketChannel %p disconnect", this);
-#if ENABLE(INSPECTOR)
- if (m_context)
- if (InspectorController* controller = m_context->inspectorController())
- controller->didCloseWebSocket(identifier());
-#endif
+ if (m_identifier && m_context)
+ InspectorInstrumentation::didCloseWebSocket(m_context, m_identifier);
m_handshake.clearScriptExecutionContext();
m_client = 0;
m_context = 0;
@@ -154,10 +151,8 @@ void WebSocketChannel::didOpen(SocketStreamHandle* handle)
ASSERT(handle == m_handle);
if (!m_context)
return;
-#if ENABLE(INSPECTOR)
- if (InspectorController* controller = m_context->inspectorController())
- controller->willSendWebSocketHandshakeRequest(identifier(), m_handshake.clientHandshakeRequest());
-#endif
+ if (m_identifier)
+ InspectorInstrumentation::willSendWebSocketHandshakeRequest(m_context, m_identifier, m_handshake.clientHandshakeRequest());
CString handshakeMessage = m_handshake.clientHandshakeMessage();
if (!handle->send(handshakeMessage.data(), handshakeMessage.length())) {
m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error sending handshake message.", 0, m_handshake.clientOrigin());
@@ -168,11 +163,8 @@ void WebSocketChannel::didOpen(SocketStreamHandle* handle)
void WebSocketChannel::didClose(SocketStreamHandle* handle)
{
LOG(Network, "WebSocketChannel %p didClose", this);
-#if ENABLE(INSPECTOR)
- if (m_context)
- if (InspectorController* controller = m_context->inspectorController())
- controller->didCloseWebSocket(identifier());
-#endif
+ if (m_identifier && m_context)
+ InspectorInstrumentation::didCloseWebSocket(m_context, m_identifier);
ASSERT_UNUSED(handle, handle == m_handle || !m_handle);
m_closed = true;
if (m_handle) {
@@ -276,10 +268,8 @@ bool WebSocketChannel::processBuffer()
if (headerLength <= 0)
return false;
if (m_handshake.mode() == WebSocketHandshake::Connected) {
-#if ENABLE(INSPECTOR)
- if (InspectorController* controller = m_context->inspectorController())
- controller->didReceiveWebSocketHandshakeResponse(identifier(), m_handshake.serverHandshakeResponse());
-#endif
+ if (m_identifier)
+ InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(m_context, m_identifier, m_handshake.serverHandshakeResponse());
if (!m_handshake.serverSetCookie().isEmpty()) {
if (m_context->isDocument()) {
Document* document = static_cast<Document*>(m_context);
@@ -397,21 +387,6 @@ void WebSocketChannel::resumeTimerFired(Timer<WebSocketChannel>* timer)
didClose(m_handle.get());
}
-#if ENABLE(INSPECTOR)
-unsigned long WebSocketChannel::identifier()
-{
- if (m_identifier)
- return m_identifier;
-
- if (InspectorController* controller = m_context->inspectorController())
- if (Page* page = controller->inspectedPage())
- m_identifier = page->progress()->createUniqueIdentifier();
-
- ASSERT(m_identifier);
- return m_identifier;
-}
-#endif // ENABLE(INSPECTOR)
-
} // namespace WebCore
#endif // ENABLE(WEB_SOCKETS)
diff --git a/WebCore/websockets/WebSocketChannel.h b/WebCore/websockets/WebSocketChannel.h
index a08e6bb..9c52377 100644
--- a/WebCore/websockets/WebSocketChannel.h
+++ b/WebCore/websockets/WebSocketChannel.h
@@ -84,10 +84,6 @@ namespace WebCore {
bool processBuffer();
void resumeTimerFired(Timer<WebSocketChannel>* timer);
-#if ENABLE(INSPECTOR)
- unsigned long identifier();
-#endif
-
ScriptExecutionContext* m_context;
WebSocketChannelClient* m_client;
WebSocketHandshake m_handshake;
@@ -101,9 +97,7 @@ namespace WebCore {
bool m_shouldDiscardReceivedData;
unsigned long m_unhandledBufferedAmount;
-#if ENABLE(INSPECTOR)
- unsigned long m_identifier;
-#endif
+ unsigned long m_identifier; // m_identifier == 0 means that we could not obtain a valid identifier.
};
} // namespace WebCore
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list