| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 274 } |
| 275 | 275 |
| 276 void DocumentWebSocketChannel::disconnect() | 276 void DocumentWebSocketChannel::disconnect() |
| 277 { | 277 { |
| 278 WTF_LOG(Network, "DocumentWebSocketChannel %p disconnect()", this); | 278 WTF_LOG(Network, "DocumentWebSocketChannel %p disconnect()", this); |
| 279 if (m_identifier) { | 279 if (m_identifier) { |
| 280 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketDestroy", TRACE_EVEN
T_SCOPE_THREAD, "data", InspectorWebSocketEvent::data(document(), m_identifier))
; | 280 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketDestroy", TRACE_EVEN
T_SCOPE_THREAD, "data", InspectorWebSocketEvent::data(document(), m_identifier))
; |
| 281 InspectorInstrumentation::didCloseWebSocket(document(), m_identifier); | 281 InspectorInstrumentation::didCloseWebSocket(document(), m_identifier); |
| 282 } | 282 } |
| 283 abortAsyncOperations(); | 283 abortAsyncOperations(); |
| 284 m_handle.clear(); | 284 m_handle.reset(); |
| 285 m_client = nullptr; | 285 m_client = nullptr; |
| 286 m_identifier = 0; | 286 m_identifier = 0; |
| 287 } | 287 } |
| 288 | 288 |
| 289 DocumentWebSocketChannel::Message::Message(const CString& text) | 289 DocumentWebSocketChannel::Message::Message(const CString& text) |
| 290 : type(MessageTypeText) | 290 : type(MessageTypeText) |
| 291 , text(text) { } | 291 , text(text) { } |
| 292 | 292 |
| 293 DocumentWebSocketChannel::Message::Message(PassRefPtr<BlobDataHandle> blobDataHa
ndle) | 293 DocumentWebSocketChannel::Message::Message(PassRefPtr<BlobDataHandle> blobDataHa
ndle) |
| 294 : type(MessageTypeBlob) | 294 : type(MessageTypeBlob) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 void DocumentWebSocketChannel::abortAsyncOperations() | 384 void DocumentWebSocketChannel::abortAsyncOperations() |
| 385 { | 385 { |
| 386 if (m_blobLoader) { | 386 if (m_blobLoader) { |
| 387 m_blobLoader->cancel(); | 387 m_blobLoader->cancel(); |
| 388 m_blobLoader.clear(); | 388 m_blobLoader.clear(); |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 | 391 |
| 392 void DocumentWebSocketChannel::handleDidClose(bool wasClean, unsigned short code
, const String& reason) | 392 void DocumentWebSocketChannel::handleDidClose(bool wasClean, unsigned short code
, const String& reason) |
| 393 { | 393 { |
| 394 m_handle.clear(); | 394 m_handle.reset(); |
| 395 abortAsyncOperations(); | 395 abortAsyncOperations(); |
| 396 if (!m_client) { | 396 if (!m_client) { |
| 397 return; | 397 return; |
| 398 } | 398 } |
| 399 WebSocketChannelClient* client = m_client; | 399 WebSocketChannelClient* client = m_client; |
| 400 m_client = nullptr; | 400 m_client = nullptr; |
| 401 WebSocketChannelClient::ClosingHandshakeCompletionStatus status = | 401 WebSocketChannelClient::ClosingHandshakeCompletionStatus status = |
| 402 wasClean ? WebSocketChannelClient::ClosingHandshakeComplete : WebSocketC
hannelClient::ClosingHandshakeIncomplete; | 402 wasClean ? WebSocketChannelClient::ClosingHandshakeComplete : WebSocketC
hannelClient::ClosingHandshakeIncomplete; |
| 403 client->didClose(status, code, reason); | 403 client->didClose(status, code, reason); |
| 404 // client->didClose may delete this object. | 404 // client->didClose may delete this object. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } | 512 } |
| 513 } | 513 } |
| 514 | 514 |
| 515 void DocumentWebSocketChannel::didClose(WebSocketHandle* handle, bool wasClean,
unsigned short code, const WebString& reason) | 515 void DocumentWebSocketChannel::didClose(WebSocketHandle* handle, bool wasClean,
unsigned short code, const WebString& reason) |
| 516 { | 516 { |
| 517 WTF_LOG(Network, "DocumentWebSocketChannel %p didClose(%p, %d, %u, %s)", thi
s, handle, wasClean, code, String(reason).utf8().data()); | 517 WTF_LOG(Network, "DocumentWebSocketChannel %p didClose(%p, %d, %u, %s)", thi
s, handle, wasClean, code, String(reason).utf8().data()); |
| 518 | 518 |
| 519 ASSERT(m_handle); | 519 ASSERT(m_handle); |
| 520 ASSERT(handle == m_handle); | 520 ASSERT(handle == m_handle); |
| 521 | 521 |
| 522 m_handle.clear(); | 522 m_handle.reset(); |
| 523 | 523 |
| 524 if (m_identifier) { | 524 if (m_identifier) { |
| 525 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketDestroy", TRACE_EVEN
T_SCOPE_THREAD, "data", InspectorWebSocketEvent::data(document(), m_identifier))
; | 525 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketDestroy", TRACE_EVEN
T_SCOPE_THREAD, "data", InspectorWebSocketEvent::data(document(), m_identifier))
; |
| 526 InspectorInstrumentation::didCloseWebSocket(document(), m_identifier); | 526 InspectorInstrumentation::didCloseWebSocket(document(), m_identifier); |
| 527 m_identifier = 0; | 527 m_identifier = 0; |
| 528 } | 528 } |
| 529 | 529 |
| 530 handleDidClose(wasClean, code, reason); | 530 handleDidClose(wasClean, code, reason); |
| 531 // handleDidClose may delete this object. | 531 // handleDidClose may delete this object. |
| 532 } | 532 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 DEFINE_TRACE(DocumentWebSocketChannel) | 580 DEFINE_TRACE(DocumentWebSocketChannel) |
| 581 { | 581 { |
| 582 visitor->trace(m_blobLoader); | 582 visitor->trace(m_blobLoader); |
| 583 visitor->trace(m_messages); | 583 visitor->trace(m_messages); |
| 584 visitor->trace(m_client); | 584 visitor->trace(m_client); |
| 585 WebSocketChannel::trace(visitor); | 585 WebSocketChannel::trace(visitor); |
| 586 ContextLifecycleObserver::trace(visitor); | 586 ContextLifecycleObserver::trace(visitor); |
| 587 } | 587 } |
| 588 | 588 |
| 589 } // namespace blink | 589 } // namespace blink |
| OLD | NEW |