Title: [111537] trunk/Source
Revision
111537
Author
[email protected]
Date
2012-03-21 07:00:35 -0700 (Wed, 21 Mar 2012)

Log Message

[Chromium] [WebSocket] provide WebFrameClient with a chance of
accessing to opening WebSocketStreamHandle.
https://bugs.webkit.org/show_bug.cgi?id=78459

Reviewed by Kent Tamura and Darin Fisher.

Source/WebCore:

Add willOpenSocketStream client function to WebFrameClient with an
argument representing an opening SocketStreamHandle.
These mechanisms provide embedders with a chance to bind arbitrary
data to a WebSocketStreamHandle from WebFrameClient to which the
WebSocket object having the WebSocketStreamHandle belongs.

No new tests because this change just provide mechanisms to embedders.

* Modules/websockets/WebSocketChannel.cpp: Implement willOpenSocketStream to call a client function in WebFrameClient.
(WebCore::WebSocketChannel::willOpenSocketStream):
(WebCore):
* Modules/websockets/WebSocketChannel.h: Add willOpenSocketStream declaration.
(WebSocketChannel):
* loader/FrameLoaderClient.h: Add dispatchWillOpenSocketStream declaration.
(WebCore):
(FrameLoaderClient):
(WebCore::FrameLoaderClient::dispatchWillOpenSocketStream):
* platform/network/SocketStreamHandleClient.h: Add willOpenSocketStream declaration.
(WebCore::SocketStreamHandleClient::willOpenSocketStream):

Source/WebKit/chromium:

Add dispatchWillOpenSocketStream client function to WebFrameClient with
an argument representing an opening SocketStreamHandle.
These mechanisms provide embedders with a chance to bind arbitrary
data to a WebSocketStreamHandle from WebFrameClient to which the
WebSocket object having the WebSocketStreamHandle belongs.

No new tests because this change just provide mechanisms to embedders.

* public/WebFrameClient.h: Add dispatchWillOpenSocketStream declaration.
(WebKit):
(WebFrameClient):
(WebKit::WebFrameClient::willOpenSocketStream):
* public/platform/WebSocketStreamHandle.h: Add default implementation to virtual functions.
(WebKit::WebSocketStreamHandle::connect):
(WebKit::WebSocketStreamHandle::send):
(WebKit::WebSocketStreamHandle::close):
* src/FrameLoaderClientImpl.cpp: Implement dispatchWillOpenSocketStream.
(WebKit::FrameLoaderClientImpl::dispatchWillOpenSocketStream):
(WebKit):
* src/FrameLoaderClientImpl.h: Add dispatchWillOpenSocketStream declaratioin.
(FrameLoaderClientImpl):
* src/SocketStreamHandle.cpp: Call willOpenSocketStream client function.
(WebCore::SocketStreamHandleInternal::connect):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111536 => 111537)


--- trunk/Source/WebCore/ChangeLog	2012-03-21 13:56:12 UTC (rev 111536)
+++ trunk/Source/WebCore/ChangeLog	2012-03-21 14:00:35 UTC (rev 111537)
@@ -1,3 +1,31 @@
+2012-03-21  Takashi Toyoshima  <[email protected]>
+
+        [Chromium] [WebSocket] provide WebFrameClient with a chance of
+        accessing to opening WebSocketStreamHandle.
+        https://bugs.webkit.org/show_bug.cgi?id=78459
+
+        Reviewed by Kent Tamura and Darin Fisher.
+
+        Add willOpenSocketStream client function to WebFrameClient with an
+        argument representing an opening SocketStreamHandle.
+        These mechanisms provide embedders with a chance to bind arbitrary
+        data to a WebSocketStreamHandle from WebFrameClient to which the
+        WebSocket object having the WebSocketStreamHandle belongs.
+
+        No new tests because this change just provide mechanisms to embedders.
+
+        * Modules/websockets/WebSocketChannel.cpp: Implement willOpenSocketStream to call a client function in WebFrameClient.
+        (WebCore::WebSocketChannel::willOpenSocketStream):
+        (WebCore):
+        * Modules/websockets/WebSocketChannel.h: Add willOpenSocketStream declaration.
+        (WebSocketChannel):
+        * loader/FrameLoaderClient.h: Add dispatchWillOpenSocketStream declaration.
+        (WebCore):
+        (FrameLoaderClient):
+        (WebCore::FrameLoaderClient::dispatchWillOpenSocketStream):
+        * platform/network/SocketStreamHandleClient.h: Add willOpenSocketStream declaration.
+        (WebCore::SocketStreamHandleClient::willOpenSocketStream):
+
 2012-03-21  Vineet Chaudhary  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=81761

Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp (111536 => 111537)


--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp	2012-03-21 13:56:12 UTC (rev 111536)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp	2012-03-21 14:00:35 UTC (rev 111537)
@@ -39,6 +39,9 @@
 #include "Document.h"
 #include "FileError.h"
 #include "FileReaderLoader.h"
+#include "Frame.h"
+#include "FrameLoader.h"
+#include "FrameLoaderClient.h"
 #include "InspectorInstrumentation.h"
 #include "Logging.h"
 #include "Page.h"
@@ -265,6 +268,14 @@
         m_resumeTimer.startOneShot(0);
 }
 
+void WebSocketChannel::willOpenSocketStream(SocketStreamHandle* handle)
+{
+    LOG(Network, "WebSocketChannel %p willOpensocketStream", this);
+    ASSERT(handle);
+    if (m_document->frame())
+        m_document->frame()->loader()->client()->dispatchWillOpenSocketStream(handle);
+}
+
 void WebSocketChannel::didOpenSocketStream(SocketStreamHandle* handle)
 {
     LOG(Network, "WebSocketChannel %p didOpenSocketStream", this);

Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.h (111536 => 111537)


--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.h	2012-03-21 13:56:12 UTC (rev 111536)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.h	2012-03-21 14:00:35 UTC (rev 111537)
@@ -84,6 +84,7 @@
     virtual void resume() OVERRIDE;
 
     // SocketStreamHandleClient functions.
+    virtual void willOpenSocketStream(SocketStreamHandle*) OVERRIDE;
     virtual void didOpenSocketStream(SocketStreamHandle*) OVERRIDE;
     virtual void didCloseSocketStream(SocketStreamHandle*) OVERRIDE;
     virtual void didReceiveSocketStreamData(SocketStreamHandle*, const char*, int) OVERRIDE;

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (111536 => 111537)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2012-03-21 13:56:12 UTC (rev 111536)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2012-03-21 14:00:35 UTC (rev 111537)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -95,6 +96,7 @@
     class ResourceResponse;
     class SecurityOrigin;
     class SharedBuffer;
+    class SocketStreamHandle;
     class StringWithDirection;
     class SubstituteData;
     class Widget;
@@ -328,6 +330,8 @@
 #if ENABLE(WEB_INTENTS)
         virtual void dispatchIntent(PassRefPtr<IntentRequest>) = 0;
 #endif
+
+        virtual void dispatchWillOpenSocketStream(SocketStreamHandle*) { }
     };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/network/SocketStreamHandleClient.h (111536 => 111537)


--- trunk/Source/WebCore/platform/network/SocketStreamHandleClient.h	2012-03-21 13:56:12 UTC (rev 111536)
+++ trunk/Source/WebCore/platform/network/SocketStreamHandleClient.h	2012-03-21 14:00:35 UTC (rev 111537)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2009, 2011 Google Inc.  All rights reserved.
+ * Copyright (C) 2009, 2011, 2012 Google Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -43,6 +43,7 @@
     public:
         virtual ~SocketStreamHandleClient() { }
 
+        virtual void willOpenSocketStream(SocketStreamHandle*) { }
         virtual void didOpenSocketStream(SocketStreamHandle*) { }
         virtual void didCloseSocketStream(SocketStreamHandle*) { }
         virtual void didReceiveSocketStreamData(SocketStreamHandle*, const char* /*data*/, int /*length*/) { }

Modified: trunk/Source/WebKit/chromium/ChangeLog (111536 => 111537)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-21 13:56:12 UTC (rev 111536)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-21 14:00:35 UTC (rev 111537)
@@ -1,3 +1,35 @@
+2012-03-21  Takashi Toyoshima  <[email protected]>
+
+        [Chromium] [WebSocket] provide WebFrameClient with a chance of
+        accessing to opening WebSocketStreamHandle.
+        https://bugs.webkit.org/show_bug.cgi?id=78459
+
+        Reviewed by Kent Tamura and Darin Fisher.
+
+        Add dispatchWillOpenSocketStream client function to WebFrameClient with
+        an argument representing an opening SocketStreamHandle.
+        These mechanisms provide embedders with a chance to bind arbitrary
+        data to a WebSocketStreamHandle from WebFrameClient to which the
+        WebSocket object having the WebSocketStreamHandle belongs.
+
+        No new tests because this change just provide mechanisms to embedders.
+
+        * public/WebFrameClient.h: Add dispatchWillOpenSocketStream declaration.
+        (WebKit):
+        (WebFrameClient):
+        (WebKit::WebFrameClient::willOpenSocketStream):
+        * public/platform/WebSocketStreamHandle.h: Add default implementation to virtual functions.
+        (WebKit::WebSocketStreamHandle::connect):
+        (WebKit::WebSocketStreamHandle::send):
+        (WebKit::WebSocketStreamHandle::close):
+        * src/FrameLoaderClientImpl.cpp: Implement dispatchWillOpenSocketStream.
+        (WebKit::FrameLoaderClientImpl::dispatchWillOpenSocketStream):
+        (WebKit):
+        * src/FrameLoaderClientImpl.h: Add dispatchWillOpenSocketStream declaratioin.
+        (FrameLoaderClientImpl):
+        * src/SocketStreamHandle.cpp: Call willOpenSocketStream client function.
+        (WebCore::SocketStreamHandleInternal::connect):
+
 2012-03-21  Ian Vollick  <[email protected]>
 
         [chromium] timing functions are getting incorrectly applied for accelerated css transitions

Modified: trunk/Source/WebKit/chromium/public/WebFrameClient.h (111536 => 111537)


--- trunk/Source/WebKit/chromium/public/WebFrameClient.h	2012-03-21 13:56:12 UTC (rev 111536)
+++ trunk/Source/WebKit/chromium/public/WebFrameClient.h	2012-03-21 14:00:35 UTC (rev 111537)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -63,6 +63,8 @@
 class WebNode;
 class WebPlugin;
 class WebSharedWorker;
+class WebSharedWorkerClient;
+class WebSocketStreamHandle;
 class WebStorageQuotaCallbacks;
 class WebString;
 class WebURL;
@@ -70,7 +72,6 @@
 class WebURLRequest;
 class WebURLResponse;
 class WebWorker;
-class WebSharedWorkerClient;
 struct WebPluginParams;
 struct WebRect;
 struct WebSize;
@@ -381,6 +382,11 @@
     // object to coordinate replies to the intent invocation.
     virtual void dispatchIntent(WebFrame*, const WebIntentRequest&) { }
 
+    // WebSocket -----------------------------------------------------
+
+    // A WebSocket object is going to open new stream connection.
+    virtual void willOpenSocketStream(WebSocketStreamHandle*) { }
+
     // Messages ------------------------------------------------------
 
     // Notifies the embedder that a postMessage was issued on this frame, and

Modified: trunk/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h (111536 => 111537)


--- trunk/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h	2012-03-21 13:56:12 UTC (rev 111536)
+++ trunk/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h	2012-03-21 14:00:35 UTC (rev 111537)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -44,13 +44,13 @@
     virtual ~WebSocketStreamHandle() { }
 
     // Connect new socket stream asynchronously.
-    virtual void connect(const WebURL&, WebSocketStreamHandleClient*) = 0;
+    virtual void connect(const WebURL&, WebSocketStreamHandleClient*) { }
 
     // Send web socket frame data on the socket stream.
-    virtual bool send(const WebData&) = 0;
+    virtual bool send(const WebData&) { return false; }
 
     // Close the socket stream.
-    virtual void close() = 0;
+    virtual void close() { }
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp (111536 => 111537)


--- trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp	2012-03-21 13:56:12 UTC (rev 111536)
+++ trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp	2012-03-21 14:00:35 UTC (rev 111537)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
  * Copyright (C) 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -59,6 +59,7 @@
 #include "ResourceHandleInternal.h"
 #include "ResourceLoader.h"
 #include "Settings.h"
+#include "SocketStreamHandleInternal.h"
 #include "WebDOMEvent.h"
 #include "WebDataSourceImpl.h"
 #include "WebDevToolsAgentPrivate.h"
@@ -75,6 +76,7 @@
 #include "WebPluginLoadObserver.h"
 #include "WebPluginParams.h"
 #include "WebSecurityOrigin.h"
+#include "platform/WebSocketStreamHandle.h"
 #include "WebViewClient.h"
 #include "WebViewImpl.h"
 #include "WindowFeatures.h"
@@ -1623,4 +1625,9 @@
 }
 #endif
 
+void FrameLoaderClientImpl::dispatchWillOpenSocketStream(SocketStreamHandle* handle)
+{
+    m_webFrame->client()->willOpenSocketStream(SocketStreamHandleInternal::toWebSocketStreamHandle(handle));
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h (111536 => 111537)


--- trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h	2012-03-21 13:56:12 UTC (rev 111536)
+++ trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h	2012-03-21 14:00:35 UTC (rev 111537)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
  * Copyright (C) 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -210,6 +210,8 @@
     virtual void dispatchIntent(PassRefPtr<WebCore::IntentRequest>) OVERRIDE;
 #endif
 
+    virtual void dispatchWillOpenSocketStream(WebCore::SocketStreamHandle*) OVERRIDE;
+
 private:
     void makeDocumentView();
 

Modified: trunk/Source/WebKit/chromium/src/SocketStreamHandle.cpp (111536 => 111537)


--- trunk/Source/WebKit/chromium/src/SocketStreamHandle.cpp	2012-03-21 13:56:12 UTC (rev 111536)
+++ trunk/Source/WebKit/chromium/src/SocketStreamHandle.cpp	2012-03-21 14:00:35 UTC (rev 111537)
@@ -64,6 +64,9 @@
     m_socket = adoptPtr(webKitPlatformSupport()->createSocketStreamHandle());
     LOG(Network, "connect");
     ASSERT(m_socket);
+    ASSERT(m_handle);
+    if (m_handle->m_client)
+        m_handle->m_client->willOpenSocketStream(m_handle);
     m_socket->connect(url, this);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to