summaryrefslogtreecommitdiff
path: root/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.cpp')
-rw-r--r--Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.cpp b/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.cpp
index 919c60501..18aaa8c12 100644
--- a/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.cpp
+++ b/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.cpp
@@ -31,7 +31,6 @@
#include "config.h"
#if ENABLE(WEB_SOCKETS)
-
#include "ThreadableWebSocketChannel.h"
#include "Document.h"
@@ -43,27 +42,18 @@
#include "WorkerRunLoop.h"
#include "WorkerThread.h"
#include "WorkerThreadableWebSocketChannel.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/text/WTFString.h>
namespace WebCore {
-static const char webSocketChannelMode[] = "webSocketChannelMode";
-
-PassRefPtr<ThreadableWebSocketChannel> ThreadableWebSocketChannel::create(ScriptExecutionContext* context, WebSocketChannelClient* client)
+Ref<ThreadableWebSocketChannel> ThreadableWebSocketChannel::create(ScriptExecutionContext& context, WebSocketChannelClient& client, SocketProvider& provider)
{
- ASSERT(context);
- ASSERT(client);
-
- if (context->isWorkerGlobalScope()) {
- WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(context);
- WorkerRunLoop& runLoop = workerGlobalScope->thread()->runLoop();
- String mode = webSocketChannelMode;
- mode.append(String::number(runLoop.createUniqueId()));
- return WorkerThreadableWebSocketChannel::create(workerGlobalScope, client, mode);
+ if (is<WorkerGlobalScope>(context)) {
+ WorkerGlobalScope& workerGlobalScope = downcast<WorkerGlobalScope>(context);
+ WorkerRunLoop& runLoop = workerGlobalScope.thread().runLoop();
+ return WorkerThreadableWebSocketChannel::create(workerGlobalScope, client, makeString("webSocketChannelMode", String::number(runLoop.createUniqueId())), provider);
}
- return WebSocketChannel::create(toDocument(context), client);
+ return WebSocketChannel::create(downcast<Document>(context), client, provider);
}
} // namespace WebCore