OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 21 matching lines...) Expand all Loading... |
32 #include "modules/websockets/NewWebSocketChannelImpl.h" | 32 #include "modules/websockets/NewWebSocketChannelImpl.h" |
33 | 33 |
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/fileapi/FileReaderLoader.h" | 36 #include "core/fileapi/FileReaderLoader.h" |
37 #include "core/fileapi/FileReaderLoaderClient.h" | 37 #include "core/fileapi/FileReaderLoaderClient.h" |
38 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
39 #include "core/inspector/InspectorInstrumentation.h" | 39 #include "core/inspector/InspectorInstrumentation.h" |
40 #include "core/inspector/InspectorTraceEvents.h" | 40 #include "core/inspector/InspectorTraceEvents.h" |
41 #include "core/loader/FrameLoader.h" | 41 #include "core/loader/FrameLoader.h" |
| 42 #include "core/loader/FrameLoaderClient.h" |
42 #include "core/loader/MixedContentChecker.h" | 43 #include "core/loader/MixedContentChecker.h" |
43 #include "core/loader/UniqueIdentifier.h" | 44 #include "core/loader/UniqueIdentifier.h" |
44 #include "modules/websockets/WebSocketChannelClient.h" | 45 #include "modules/websockets/WebSocketChannelClient.h" |
45 #include "modules/websockets/WebSocketFrame.h" | 46 #include "modules/websockets/WebSocketFrame.h" |
46 #include "platform/Logging.h" | 47 #include "platform/Logging.h" |
47 #include "platform/network/WebSocketHandshakeRequest.h" | 48 #include "platform/network/WebSocketHandshakeRequest.h" |
48 #include "platform/weborigin/SecurityOrigin.h" | 49 #include "platform/weborigin/SecurityOrigin.h" |
49 #include "public/platform/Platform.h" | 50 #include "public/platform/Platform.h" |
50 #include "public/platform/WebSerializedOrigin.h" | 51 #include "public/platform/WebSerializedOrigin.h" |
51 #include "public/platform/WebSocketHandshakeRequestInfo.h" | 52 #include "public/platform/WebSocketHandshakeRequestInfo.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // empty. | 148 // empty. |
148 if (!protocol.isEmpty()) { | 149 if (!protocol.isEmpty()) { |
149 // Since protocol is already verified and escaped, we can simply split | 150 // Since protocol is already verified and escaped, we can simply split |
150 // it. | 151 // it. |
151 protocol.split(", ", true, protocols); | 152 protocol.split(", ", true, protocols); |
152 } | 153 } |
153 blink::WebVector<blink::WebString> webProtocols(protocols.size()); | 154 blink::WebVector<blink::WebString> webProtocols(protocols.size()); |
154 for (size_t i = 0; i < protocols.size(); ++i) { | 155 for (size_t i = 0; i < protocols.size(); ++i) { |
155 webProtocols[i] = protocols[i]; | 156 webProtocols[i] = protocols[i]; |
156 } | 157 } |
| 158 |
| 159 if (executionContext()->isDocument() && document()->frame()) |
| 160 document()->frame()->loader().client()->dispatchWillOpenWebSocket(m_hand
le.get()); |
157 m_handle->connect(url, webProtocols, *executionContext()->securityOrigin(),
this); | 161 m_handle->connect(url, webProtocols, *executionContext()->securityOrigin(),
this); |
| 162 |
158 flowControlIfNecessary(); | 163 flowControlIfNecessary(); |
159 if (m_identifier) { | 164 if (m_identifier) { |
160 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We
bSocketCreate", "data", InspectorWebSocketCreateEvent::data(document(), m_identi
fier, url, protocol)); | 165 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "We
bSocketCreate", "data", InspectorWebSocketCreateEvent::data(document(), m_identi
fier, url, protocol)); |
161 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"
), "CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 166 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"
), "CallStack", "stack", InspectorCallStackEvent::currentCallStack()); |
162 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti
meline migrates to tracing. | 167 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti
meline migrates to tracing. |
163 InspectorInstrumentation::didCreateWebSocket(document(), m_identifier, u
rl, protocol); | 168 InspectorInstrumentation::didCreateWebSocket(document(), m_identifier, u
rl, protocol); |
164 } | 169 } |
165 return true; | 170 return true; |
166 } | 171 } |
167 | 172 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 // |this| can be deleted here. | 562 // |this| can be deleted here. |
558 } | 563 } |
559 | 564 |
560 void NewWebSocketChannelImpl::trace(Visitor* visitor) | 565 void NewWebSocketChannelImpl::trace(Visitor* visitor) |
561 { | 566 { |
562 visitor->trace(m_blobLoader); | 567 visitor->trace(m_blobLoader); |
563 WebSocketChannel::trace(visitor); | 568 WebSocketChannel::trace(visitor); |
564 } | 569 } |
565 | 570 |
566 } // namespace WebCore | 571 } // namespace WebCore |
OLD | NEW |