| OLD | NEW |
| 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 Loading... |
| 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/NewWebSocketChannelImpl.h" | 41 #include "modules/websockets/DocumentWebSocketChannel.h" |
| 42 #include "modules/websockets/WebSocketChannelClient.h" | 42 #include "modules/websockets/WebSocketChannelClient.h" |
| 43 #include "modules/websockets/WorkerThreadableWebSocketChannel.h" | 43 #include "modules/websockets/WorkerThreadableWebSocketChannel.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 WebSocketChannel* WebSocketChannel::create(ExecutionContext* context, WebSocketC
hannelClient* client) | 47 WebSocketChannel* WebSocketChannel::create(ExecutionContext* context, WebSocketC
hannelClient* client) |
| 48 { | 48 { |
| 49 ASSERT(context); | 49 ASSERT(context); |
| 50 ASSERT(client); | 50 ASSERT(client); |
| 51 | 51 |
| 52 String sourceURL; | 52 String sourceURL; |
| 53 unsigned lineNumber = 0; | 53 unsigned lineNumber = 0; |
| 54 RefPtrWillBeRawPtr<ScriptCallStack> callStack = createScriptCallStack(1, tru
e); | 54 RefPtrWillBeRawPtr<ScriptCallStack> callStack = createScriptCallStack(1, tru
e); |
| 55 if (callStack && callStack->size()) { | 55 if (callStack && callStack->size()) { |
| 56 sourceURL = callStack->at(0).sourceURL(); | 56 sourceURL = callStack->at(0).sourceURL(); |
| 57 lineNumber = callStack->at(0).lineNumber(); | 57 lineNumber = callStack->at(0).lineNumber(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 if (context->isWorkerGlobalScope()) { | 60 if (context->isWorkerGlobalScope()) { |
| 61 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); | 61 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); |
| 62 return WorkerThreadableWebSocketChannel::create(*workerGlobalScope, clie
nt, sourceURL, lineNumber); | 62 return WorkerThreadableWebSocketChannel::create(*workerGlobalScope, clie
nt, sourceURL, lineNumber); |
| 63 } | 63 } |
| 64 | 64 |
| 65 Document* document = toDocument(context); | 65 Document* document = toDocument(context); |
| 66 return NewWebSocketChannelImpl::create(document, client, sourceURL, lineNumb
er); | 66 return DocumentWebSocketChannel::create(document, client, sourceURL, lineNum
ber); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace blink | 69 } // namespace blink |
| OLD | NEW |