| 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 "modules/websockets/WebSocketChannel.h" | 31 #include "modules/websockets/WebSocketChannel.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/SourceLocation.h" | 33 #include "bindings/core/v8/SourceLocation.h" |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/dom/ExecutionContext.h" | 35 #include "core/dom/ExecutionContext.h" |
| 36 #include "core/workers/WorkerGlobalScope.h" | 36 #include "core/workers/WorkerGlobalScope.h" |
| 37 #include "core/workers/WorkerThread.h" | 37 #include "core/workers/WorkerThread.h" |
| 38 #include "modules/websockets/DocumentWebSocketChannel.h" | 38 #include "modules/websockets/DocumentWebSocketChannel.h" |
| 39 #include "modules/websockets/WebSocketChannelClient.h" | 39 #include "modules/websockets/WebSocketChannelClient.h" |
| 40 #include "modules/websockets/WorkerWebSocketChannel.h" | 40 #include "modules/websockets/WorkerWebSocketChannel.h" |
| 41 #include <memory> | |
| 42 | 41 |
| 43 namespace blink { | 42 namespace blink { |
| 44 | 43 |
| 45 WebSocketChannel* WebSocketChannel::create(ExecutionContext* context, WebSocketC
hannelClient* client) | 44 WebSocketChannel* WebSocketChannel::create(ExecutionContext* context, WebSocketC
hannelClient* client) |
| 46 { | 45 { |
| 47 ASSERT(context); | 46 ASSERT(context); |
| 48 ASSERT(client); | 47 ASSERT(client); |
| 49 | 48 |
| 50 std::unique_ptr<SourceLocation> location = SourceLocation::capture(context); | 49 OwnPtr<SourceLocation> location = SourceLocation::capture(context); |
| 51 | 50 |
| 52 if (context->isWorkerGlobalScope()) { | 51 if (context->isWorkerGlobalScope()) { |
| 53 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); | 52 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); |
| 54 return WorkerWebSocketChannel::create(*workerGlobalScope, client, std::m
ove(location)); | 53 return WorkerWebSocketChannel::create(*workerGlobalScope, client, std::m
ove(location)); |
| 55 } | 54 } |
| 56 | 55 |
| 57 Document* document = toDocument(context); | 56 Document* document = toDocument(context); |
| 58 return DocumentWebSocketChannel::create(document, client, std::move(location
)); | 57 return DocumentWebSocketChannel::create(document, client, std::move(location
)); |
| 59 } | 58 } |
| 60 | 59 |
| 61 } // namespace blink | 60 } // namespace blink |
| OLD | NEW |