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> |
41 | 42 |
42 namespace blink { | 43 namespace blink { |
43 | 44 |
44 WebSocketChannel* WebSocketChannel::create(ExecutionContext* context, WebSocketC
hannelClient* client) | 45 WebSocketChannel* WebSocketChannel::create(ExecutionContext* context, WebSocketC
hannelClient* client) |
45 { | 46 { |
46 ASSERT(context); | 47 ASSERT(context); |
47 ASSERT(client); | 48 ASSERT(client); |
48 | 49 |
49 OwnPtr<SourceLocation> location = SourceLocation::capture(context); | 50 std::unique_ptr<SourceLocation> location = SourceLocation::capture(context); |
50 | 51 |
51 if (context->isWorkerGlobalScope()) { | 52 if (context->isWorkerGlobalScope()) { |
52 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); | 53 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); |
53 return WorkerWebSocketChannel::create(*workerGlobalScope, client, std::m
ove(location)); | 54 return WorkerWebSocketChannel::create(*workerGlobalScope, client, std::m
ove(location)); |
54 } | 55 } |
55 | 56 |
56 Document* document = toDocument(context); | 57 Document* document = toDocument(context); |
57 return DocumentWebSocketChannel::create(document, client, std::move(location
)); | 58 return DocumentWebSocketChannel::create(document, client, std::move(location
)); |
58 } | 59 } |
59 | 60 |
60 } // namespace blink | 61 } // namespace blink |
OLD | NEW |