diff options
Diffstat (limited to 'Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.cpp')
-rw-r--r-- | Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.cpp | 22 |
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 |