| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "public/platform/Platform.h" | 51 #include "public/platform/Platform.h" |
| 52 #include "public/platform/WebSecurityOrigin.h" | 52 #include "public/platform/WebSecurityOrigin.h" |
| 53 #include "public/platform/WebString.h" | 53 #include "public/platform/WebString.h" |
| 54 #include "public/platform/WebURL.h" | 54 #include "public/platform/WebURL.h" |
| 55 #include "public/platform/WebVector.h" | 55 #include "public/platform/WebVector.h" |
| 56 #include "public/platform/modules/websockets/WebSocketHandshakeRequestInfo.h" | 56 #include "public/platform/modules/websockets/WebSocketHandshakeRequestInfo.h" |
| 57 #include "public/platform/modules/websockets/WebSocketHandshakeResponseInfo.h" | 57 #include "public/platform/modules/websockets/WebSocketHandshakeResponseInfo.h" |
| 58 #include "wtf/PtrUtil.h" | 58 #include "wtf/PtrUtil.h" |
| 59 #include <memory> | 59 #include <memory> |
| 60 | 60 |
| 61 using blink::WebSocketHandle; | |
| 62 | |
| 63 namespace blink { | 61 namespace blink { |
| 64 | 62 |
| 65 class DocumentWebSocketChannel::BlobLoader final : public GarbageCollectedFinali
zed<DocumentWebSocketChannel::BlobLoader>, public FileReaderLoaderClient { | 63 class DocumentWebSocketChannel::BlobLoader final : public GarbageCollectedFinali
zed<DocumentWebSocketChannel::BlobLoader>, public FileReaderLoaderClient { |
| 66 public: | 64 public: |
| 67 BlobLoader(PassRefPtr<BlobDataHandle>, DocumentWebSocketChannel*); | 65 BlobLoader(PassRefPtr<BlobDataHandle>, DocumentWebSocketChannel*); |
| 68 ~BlobLoader() override { } | 66 ~BlobLoader() override { } |
| 69 | 67 |
| 70 void cancel(); | 68 void cancel(); |
| 71 | 69 |
| 72 // FileReaderLoaderClient functions. | 70 // FileReaderLoaderClient functions. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // it. | 175 // it. |
| 178 protocol.split(", ", true, protocols); | 176 protocol.split(", ", true, protocols); |
| 179 } | 177 } |
| 180 WebVector<WebString> webProtocols(protocols.size()); | 178 WebVector<WebString> webProtocols(protocols.size()); |
| 181 for (size_t i = 0; i < protocols.size(); ++i) { | 179 for (size_t i = 0; i < protocols.size(); ++i) { |
| 182 webProtocols[i] = protocols[i]; | 180 webProtocols[i] = protocols[i]; |
| 183 } | 181 } |
| 184 | 182 |
| 185 if (document()->frame()) | 183 if (document()->frame()) |
| 186 document()->frame()->loader().client()->dispatchWillOpenWebSocket(m_hand
le.get()); | 184 document()->frame()->loader().client()->dispatchWillOpenWebSocket(m_hand
le.get()); |
| 187 m_handle->connect(url, webProtocols, WebSecurityOrigin(getExecutionContext()
->getSecurityOrigin()), document()->userAgent(), this); | 185 m_handle->connect(url, webProtocols, WebSecurityOrigin(getExecutionContext()
->getSecurityOrigin()), document()->firstPartyForCookies(), document()->userAgen
t(), this); |
| 186 |
| 188 flowControlIfNecessary(); | 187 flowControlIfNecessary(); |
| 189 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketCreate", TRACE_EVENT_SCO
PE_THREAD, "data", InspectorWebSocketCreateEvent::data(document(), m_identifier,
url, protocol)); | 188 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketCreate", TRACE_EVENT_SCO
PE_THREAD, "data", InspectorWebSocketCreateEvent::data(document(), m_identifier,
url, protocol)); |
| 190 InspectorInstrumentation::didCreateWebSocket(document(), m_identifier, url,
protocol); | 189 InspectorInstrumentation::didCreateWebSocket(document(), m_identifier, url,
protocol); |
| 191 return true; | 190 return true; |
| 192 } | 191 } |
| 193 | 192 |
| 194 void DocumentWebSocketChannel::send(const CString& message) | 193 void DocumentWebSocketChannel::send(const CString& message) |
| 195 { | 194 { |
| 196 WTF_LOG(Network, "DocumentWebSocketChannel %p sendText(%s)", this, message.d
ata()); | 195 WTF_LOG(Network, "DocumentWebSocketChannel %p sendText(%s)", this, message.d
ata()); |
| 197 // FIXME: Change the inspector API to show the entire message instead | 196 // FIXME: Change the inspector API to show the entire message instead |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 DEFINE_TRACE(DocumentWebSocketChannel) | 579 DEFINE_TRACE(DocumentWebSocketChannel) |
| 581 { | 580 { |
| 582 visitor->trace(m_blobLoader); | 581 visitor->trace(m_blobLoader); |
| 583 visitor->trace(m_messages); | 582 visitor->trace(m_messages); |
| 584 visitor->trace(m_client); | 583 visitor->trace(m_client); |
| 585 WebSocketChannel::trace(visitor); | 584 WebSocketChannel::trace(visitor); |
| 586 ContextLifecycleObserver::trace(visitor); | 585 ContextLifecycleObserver::trace(visitor); |
| 587 } | 586 } |
| 588 | 587 |
| 589 } // namespace blink | 588 } // namespace blink |
| OLD | NEW |