Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: Source/modules/websockets/WebSocketChannel.cpp

Issue 639333003: Delete the old WebSocket implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 20 matching lines...) Expand all
31 #include "config.h" 31 #include "config.h"
32 32
33 #include "modules/websockets/WebSocketChannel.h" 33 #include "modules/websockets/WebSocketChannel.h"
34 34
35 #include "bindings/core/v8/ScriptCallStackFactory.h" 35 #include "bindings/core/v8/ScriptCallStackFactory.h"
36 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
37 #include "core/dom/ExecutionContext.h" 37 #include "core/dom/ExecutionContext.h"
38 #include "core/inspector/ScriptCallStack.h" 38 #include "core/inspector/ScriptCallStack.h"
39 #include "core/workers/WorkerGlobalScope.h" 39 #include "core/workers/WorkerGlobalScope.h"
40 #include "core/workers/WorkerThread.h" 40 #include "core/workers/WorkerThread.h"
41 #include "modules/websockets/MainThreadWebSocketChannel.h"
42 #include "modules/websockets/NewWebSocketChannelImpl.h" 41 #include "modules/websockets/NewWebSocketChannelImpl.h"
43 #include "modules/websockets/WebSocketChannelClient.h" 42 #include "modules/websockets/WebSocketChannelClient.h"
44 #include "modules/websockets/WorkerThreadableWebSocketChannel.h" 43 #include "modules/websockets/WorkerThreadableWebSocketChannel.h"
45 #include "platform/RuntimeEnabledFeatures.h"
46 44
47 namespace blink { 45 namespace blink {
48 46
49 WebSocketChannel* WebSocketChannel::create(ExecutionContext* context, WebSocketC hannelClient* client) 47 WebSocketChannel* WebSocketChannel::create(ExecutionContext* context, WebSocketC hannelClient* client)
50 { 48 {
51 ASSERT(context); 49 ASSERT(context);
52 ASSERT(client); 50 ASSERT(client);
53 51
54 String sourceURL; 52 String sourceURL;
55 unsigned lineNumber = 0; 53 unsigned lineNumber = 0;
56 RefPtrWillBeRawPtr<ScriptCallStack> callStack = createScriptCallStack(1, tru e); 54 RefPtrWillBeRawPtr<ScriptCallStack> callStack = createScriptCallStack(1, tru e);
57 if (callStack && callStack->size()) { 55 if (callStack && callStack->size()) {
58 sourceURL = callStack->at(0).sourceURL(); 56 sourceURL = callStack->at(0).sourceURL();
59 lineNumber = callStack->at(0).lineNumber(); 57 lineNumber = callStack->at(0).lineNumber();
60 } 58 }
61 59
62 if (context->isWorkerGlobalScope()) { 60 if (context->isWorkerGlobalScope()) {
63 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); 61 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
64 return WorkerThreadableWebSocketChannel::create(*workerGlobalScope, clie nt, sourceURL, lineNumber); 62 return WorkerThreadableWebSocketChannel::create(*workerGlobalScope, clie nt, sourceURL, lineNumber);
65 } 63 }
66 64
67 Document* document = toDocument(context); 65 Document* document = toDocument(context);
68 if (RuntimeEnabledFeatures::experimentalWebSocketEnabled()) { 66 return NewWebSocketChannelImpl::create(document, client, sourceURL, lineNumb er);
69 return NewWebSocketChannelImpl::create(document, client, sourceURL, line Number);
70 }
71 return MainThreadWebSocketChannel::create(document, client, sourceURL, lineN umber);
72 } 67 }
73 68
74 } // namespace blink 69 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698