Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp

Issue 2715803004: Introduce ThreadableLoadingContext: make threaded loading code one step away from Document (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "modules/websockets/DocumentWebSocketChannel.h" 31 #include "modules/websockets/DocumentWebSocketChannel.h"
32 32
33 #include <memory> 33 #include <memory>
34 #include "core/dom/DOMArrayBuffer.h" 34 #include "core/dom/DOMArrayBuffer.h"
35 #include "core/dom/Document.h"
36 #include "core/dom/ExecutionContext.h" 35 #include "core/dom/ExecutionContext.h"
37 #include "core/fileapi/FileReaderLoader.h" 36 #include "core/fileapi/FileReaderLoader.h"
38 #include "core/fileapi/FileReaderLoaderClient.h" 37 #include "core/fileapi/FileReaderLoaderClient.h"
39 #include "core/frame/LocalFrame.h" 38 #include "core/frame/LocalFrame.h"
40 #include "core/frame/LocalFrameClient.h" 39 #include "core/frame/LocalFrameClient.h"
41 #include "core/inspector/ConsoleMessage.h" 40 #include "core/inspector/ConsoleMessage.h"
42 #include "core/inspector/InspectorInstrumentation.h" 41 #include "core/inspector/InspectorInstrumentation.h"
43 #include "core/loader/FrameLoader.h" 42 #include "core/loader/FrameLoader.h"
44 #include "core/loader/MixedContentChecker.h" 43 #include "core/loader/MixedContentChecker.h"
44 #include "core/loader/ThreadableLoadingContext.h"
45 #include "modules/websockets/InspectorWebSocketEvents.h" 45 #include "modules/websockets/InspectorWebSocketEvents.h"
46 #include "modules/websockets/WebSocketChannelClient.h" 46 #include "modules/websockets/WebSocketChannelClient.h"
47 #include "modules/websockets/WebSocketFrame.h" 47 #include "modules/websockets/WebSocketFrame.h"
48 #include "modules/websockets/WebSocketHandleImpl.h" 48 #include "modules/websockets/WebSocketHandleImpl.h"
49 #include "platform/WebFrameScheduler.h" 49 #include "platform/WebFrameScheduler.h"
50 #include "platform/loader/fetch/UniqueIdentifier.h" 50 #include "platform/loader/fetch/UniqueIdentifier.h"
51 #include "platform/network/NetworkLog.h" 51 #include "platform/network/NetworkLog.h"
52 #include "platform/network/WebSocketHandshakeRequest.h" 52 #include "platform/network/WebSocketHandshakeRequest.h"
53 #include "platform/weborigin/SecurityOrigin.h" 53 #include "platform/weborigin/SecurityOrigin.h"
54 #include "public/platform/InterfaceProvider.h" 54 #include "public/platform/InterfaceProvider.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 unsigned short code; 101 unsigned short code;
102 String reason; 102 String reason;
103 }; 103 };
104 104
105 DocumentWebSocketChannel::BlobLoader::BlobLoader( 105 DocumentWebSocketChannel::BlobLoader::BlobLoader(
106 PassRefPtr<BlobDataHandle> blobDataHandle, 106 PassRefPtr<BlobDataHandle> blobDataHandle,
107 DocumentWebSocketChannel* channel) 107 DocumentWebSocketChannel* channel)
108 : m_channel(channel), 108 : m_channel(channel),
109 m_loader( 109 m_loader(
110 FileReaderLoader::create(FileReaderLoader::ReadAsArrayBuffer, this)) { 110 FileReaderLoader::create(FileReaderLoader::ReadAsArrayBuffer, this)) {
111 // TODO(kinuko): Remove dependency to document.
111 m_loader->start(channel->document(), std::move(blobDataHandle)); 112 m_loader->start(channel->document(), std::move(blobDataHandle));
112 } 113 }
113 114
114 void DocumentWebSocketChannel::BlobLoader::cancel() { 115 void DocumentWebSocketChannel::BlobLoader::cancel() {
115 m_loader->cancel(); 116 m_loader->cancel();
116 // didFail will be called immediately. 117 // didFail will be called immediately.
117 // |this| is deleted here. 118 // |this| is deleted here.
118 } 119 }
119 120
120 void DocumentWebSocketChannel::BlobLoader::didFinishLoading() { 121 void DocumentWebSocketChannel::BlobLoader::didFinishLoading() {
121 m_channel->didFinishLoadingBlob(m_loader->arrayBufferResult()); 122 m_channel->didFinishLoadingBlob(m_loader->arrayBufferResult());
122 // |this| is deleted here. 123 // |this| is deleted here.
123 } 124 }
124 125
125 void DocumentWebSocketChannel::BlobLoader::didFail( 126 void DocumentWebSocketChannel::BlobLoader::didFail(
126 FileError::ErrorCode errorCode) { 127 FileError::ErrorCode errorCode) {
127 m_channel->didFailLoadingBlob(errorCode); 128 m_channel->didFailLoadingBlob(errorCode);
128 // |this| is deleted here. 129 // |this| is deleted here.
129 } 130 }
130 131
131 DocumentWebSocketChannel::DocumentWebSocketChannel( 132 DocumentWebSocketChannel::DocumentWebSocketChannel(
132 Document* document, 133 ThreadableLoadingContext* loadingContext,
133 WebSocketChannelClient* client, 134 WebSocketChannelClient* client,
134 std::unique_ptr<SourceLocation> location, 135 std::unique_ptr<SourceLocation> location,
135 WebSocketHandle* handle) 136 WebSocketHandle* handle)
136 : m_handle(WTF::wrapUnique(handle ? handle : new WebSocketHandleImpl())), 137 : m_handle(WTF::wrapUnique(handle ? handle : new WebSocketHandleImpl())),
137 m_client(client), 138 m_client(client),
138 m_identifier(createUniqueIdentifier()), 139 m_identifier(createUniqueIdentifier()),
139 m_document(document), 140 m_loadingContext(loadingContext),
140 m_sendingQuota(0), 141 m_sendingQuota(0),
141 m_receivedDataSizeForFlowControl( 142 m_receivedDataSizeForFlowControl(
142 receivedDataSizeForFlowControlHighWaterMark * 2), // initial quota 143 receivedDataSizeForFlowControlHighWaterMark * 2), // initial quota
143 m_sentSizeOfTopMessage(0), 144 m_sentSizeOfTopMessage(0),
144 m_locationAtConstruction(std::move(location)) {} 145 m_locationAtConstruction(std::move(location)) {}
145 146
146 DocumentWebSocketChannel::~DocumentWebSocketChannel() { 147 DocumentWebSocketChannel::~DocumentWebSocketChannel() {
147 DCHECK(!m_blobLoader); 148 DCHECK(!m_blobLoader);
148 } 149 }
149 150
150 bool DocumentWebSocketChannel::connect(const KURL& url, 151 bool DocumentWebSocketChannel::connect(const KURL& url,
151 const String& protocol) { 152 const String& protocol) {
152 NETWORK_DVLOG(1) << this << " connect()"; 153 NETWORK_DVLOG(1) << this << " connect()";
153 if (!m_handle) 154 if (!m_handle)
154 return false; 155 return false;
155 156
156 if (document()->frame()) { 157 if (document()) {
157 if (MixedContentChecker::shouldBlockWebSocket(document()->frame(), url)) 158 if (document()->frame()) {
158 return false; 159 if (MixedContentChecker::shouldBlockWebSocket(document()->frame(), url))
159 } 160 return false;
160 if (MixedContentChecker::isMixedContent(document()->getSecurityOrigin(), 161 }
161 url)) { 162 if (MixedContentChecker::isMixedContent(document()->getSecurityOrigin(),
162 String message = 163 url)) {
163 "Connecting to a non-secure WebSocket server from a secure origin is " 164 String message =
164 "deprecated."; 165 "Connecting to a non-secure WebSocket server from a secure origin is "
165 document()->addConsoleMessage( 166 "deprecated.";
166 ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message)); 167 document()->addConsoleMessage(ConsoleMessage::create(
167 } 168 JSMessageSource, WarningMessageLevel, message));
169 }
168 170
169 if (document()->frame()) { 171 if (document()->frame()) {
170 connection_handle_for_scheduler_ = 172 connection_handle_for_scheduler_ =
171 document()->frame()->frameScheduler()->onActiveConnectionCreated(); 173 document()->frame()->frameScheduler()->onActiveConnectionCreated();
174 }
172 } 175 }
173 176
174 m_url = url; 177 m_url = url;
175 Vector<String> protocols; 178 Vector<String> protocols;
176 // Avoid placing an empty token in the Vector when the protocol string is 179 // Avoid placing an empty token in the Vector when the protocol string is
177 // empty. 180 // empty.
178 if (!protocol.isEmpty()) { 181 if (!protocol.isEmpty()) {
179 // Since protocol is already verified and escaped, we can simply split 182 // Since protocol is already verified and escaped, we can simply split
180 // it. 183 // it.
181 protocol.split(", ", true, protocols); 184 protocol.split(", ", true, protocols);
182 } 185 }
183 186
184 if (document()->frame() && 187 // TODO(kinuko): document() should return nullptr if we don't
188 // have valid document/frame that returns non-empty interface provider.
189 if (document() && document()->frame() &&
185 document()->frame()->interfaceProvider() != 190 document()->frame()->interfaceProvider() !=
186 InterfaceProvider::getEmptyInterfaceProvider()) { 191 InterfaceProvider::getEmptyInterfaceProvider()) {
187 // Initialize the WebSocketHandle with the frame's InterfaceProvider to 192 // Initialize the WebSocketHandle with the frame's InterfaceProvider to
188 // provide the WebSocket implementation with context about this frame. 193 // provide the WebSocket implementation with context about this frame.
189 // This is important so that the browser can show UI associated with 194 // This is important so that the browser can show UI associated with
190 // the WebSocket (e.g., for certificate errors). 195 // the WebSocket (e.g., for certificate errors).
191 m_handle->initialize(document()->frame()->interfaceProvider()); 196 m_handle->initialize(document()->frame()->interfaceProvider());
192 } else { 197 } else {
193 m_handle->initialize(Platform::current()->interfaceProvider()); 198 m_handle->initialize(Platform::current()->interfaceProvider());
194 } 199 }
195 m_handle->connect(url, protocols, document()->getSecurityOrigin(), 200 m_handle->connect(url, protocols, m_loadingContext->getSecurityOrigin(),
196 document()->firstPartyForCookies(), document()->userAgent(), 201 m_loadingContext->firstPartyForCookies(),
197 this); 202 m_loadingContext->userAgent(), this);
198 203
199 flowControlIfNecessary(); 204 flowControlIfNecessary();
200 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketCreate", 205 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketCreate",
201 TRACE_EVENT_SCOPE_THREAD, "data", 206 TRACE_EVENT_SCOPE_THREAD, "data",
202 InspectorWebSocketCreateEvent::data( 207 InspectorWebSocketCreateEvent::data(
203 document(), m_identifier, url, protocol)); 208 document(), m_identifier, url, protocol));
204 InspectorInstrumentation::didCreateWebSocket(document(), m_identifier, url, 209 InspectorInstrumentation::didCreateWebSocket(document(), m_identifier, url,
205 protocol); 210 protocol);
206 return true; 211 return true;
207 } 212 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 294 }
290 295
291 void DocumentWebSocketChannel::fail(const String& reason, 296 void DocumentWebSocketChannel::fail(const String& reason,
292 MessageLevel level, 297 MessageLevel level,
293 std::unique_ptr<SourceLocation> location) { 298 std::unique_ptr<SourceLocation> location) {
294 NETWORK_DVLOG(1) << this << " fail(" << reason << ")"; 299 NETWORK_DVLOG(1) << this << " fail(" << reason << ")";
295 // m_handle and m_client can be null here. 300 // m_handle and m_client can be null here.
296 301
297 connection_handle_for_scheduler_.reset(); 302 connection_handle_for_scheduler_.reset();
298 303
299 InspectorInstrumentation::didReceiveWebSocketFrameError(document(), 304 if (document()) {
300 m_identifier, reason); 305 InspectorInstrumentation::didReceiveWebSocketFrameError(
301 const String message = "WebSocket connection to '" + m_url.elidedString() + 306 document(), m_identifier, reason);
302 "' failed: " + reason; 307 const String message = "WebSocket connection to '" + m_url.elidedString() +
303 document()->addConsoleMessage(ConsoleMessage::create( 308 "' failed: " + reason;
304 JSMessageSource, level, message, std::move(location))); 309 document()->addConsoleMessage(ConsoleMessage::create(
310 JSMessageSource, level, message, std::move(location)));
311 }
305 312
306 if (m_client) 313 if (m_client)
307 m_client->didError(); 314 m_client->didError();
308 // |reason| is only for logging and should not be provided for scripts, 315 // |reason| is only for logging and should not be provided for scripts,
309 // hence close reason must be empty. 316 // hence close reason must be empty.
310 handleDidClose(false, CloseEventCodeAbnormalClosure, String()); 317 handleDidClose(false, CloseEventCodeAbnormalClosure, String());
311 // handleDidClose may delete this object. 318 // handleDidClose may delete this object.
312 } 319 }
313 320
314 void DocumentWebSocketChannel::disconnect() { 321 void DocumentWebSocketChannel::disconnect() {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 } 457 }
451 WebSocketChannelClient* client = m_client; 458 WebSocketChannelClient* client = m_client;
452 m_client = nullptr; 459 m_client = nullptr;
453 WebSocketChannelClient::ClosingHandshakeCompletionStatus status = 460 WebSocketChannelClient::ClosingHandshakeCompletionStatus status =
454 wasClean ? WebSocketChannelClient::ClosingHandshakeComplete 461 wasClean ? WebSocketChannelClient::ClosingHandshakeComplete
455 : WebSocketChannelClient::ClosingHandshakeIncomplete; 462 : WebSocketChannelClient::ClosingHandshakeIncomplete;
456 client->didClose(status, code, reason); 463 client->didClose(status, code, reason);
457 // client->didClose may delete this object. 464 // client->didClose may delete this object.
458 } 465 }
459 466
467 ThreadableLoadingContext* DocumentWebSocketChannel::loadingContext() {
468 return m_loadingContext;
469 }
470
460 Document* DocumentWebSocketChannel::document() { 471 Document* DocumentWebSocketChannel::document() {
461 return m_document; 472 return m_loadingContext->getLoadingDocument();
462 } 473 }
463 474
464 void DocumentWebSocketChannel::didConnect(WebSocketHandle* handle, 475 void DocumentWebSocketChannel::didConnect(WebSocketHandle* handle,
465 const String& selectedProtocol, 476 const String& selectedProtocol,
466 const String& extensions) { 477 const String& extensions) {
467 NETWORK_DVLOG(1) << this << " didConnect(" << handle << ", " 478 NETWORK_DVLOG(1) << this << " didConnect(" << handle << ", "
468 << String(selectedProtocol) << ", " << String(extensions) 479 << String(selectedProtocol) << ", " << String(extensions)
469 << ")"; 480 << ")";
470 481
471 DCHECK(m_handle); 482 DCHECK(m_handle);
472 DCHECK_EQ(handle, m_handle.get()); 483 DCHECK_EQ(handle, m_handle.get());
473 DCHECK(m_client); 484 DCHECK(m_client);
474 485
475 m_client->didConnect(selectedProtocol, extensions); 486 m_client->didConnect(selectedProtocol, extensions);
476 } 487 }
477 488
478 void DocumentWebSocketChannel::didStartOpeningHandshake( 489 void DocumentWebSocketChannel::didStartOpeningHandshake(
479 WebSocketHandle* handle, 490 WebSocketHandle* handle,
480 PassRefPtr<WebSocketHandshakeRequest> request) { 491 PassRefPtr<WebSocketHandshakeRequest> request) {
481 NETWORK_DVLOG(1) << this << " didStartOpeningHandshake(" << handle << ")"; 492 NETWORK_DVLOG(1) << this << " didStartOpeningHandshake(" << handle << ")";
482 493
483 DCHECK(m_handle); 494 DCHECK(m_handle);
484 DCHECK_EQ(handle, m_handle.get()); 495 DCHECK_EQ(handle, m_handle.get());
485 496
486 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketSendHandshakeRequest", 497 if (document()) {
487 TRACE_EVENT_SCOPE_THREAD, "data", 498 TRACE_EVENT_INSTANT1(
488 InspectorWebSocketEvent::data(document(), m_identifier)); 499 "devtools.timeline", "WebSocketSendHandshakeRequest",
489 InspectorInstrumentation::willSendWebSocketHandshakeRequest( 500 TRACE_EVENT_SCOPE_THREAD, "data",
490 document(), m_identifier, request.get()); 501 InspectorWebSocketEvent::data(document(), m_identifier));
502 InspectorInstrumentation::willSendWebSocketHandshakeRequest(
503 document(), m_identifier, request.get());
504 }
491 m_handshakeRequest = request; 505 m_handshakeRequest = request;
492 } 506 }
493 507
494 void DocumentWebSocketChannel::didFinishOpeningHandshake( 508 void DocumentWebSocketChannel::didFinishOpeningHandshake(
495 WebSocketHandle* handle, 509 WebSocketHandle* handle,
496 const WebSocketHandshakeResponse* response) { 510 const WebSocketHandshakeResponse* response) {
497 NETWORK_DVLOG(1) << this << " didFinishOpeningHandshake(" << handle << ")"; 511 NETWORK_DVLOG(1) << this << " didFinishOpeningHandshake(" << handle << ")";
498 512
499 DCHECK(m_handle); 513 DCHECK(m_handle);
500 DCHECK_EQ(handle, m_handle.get()); 514 DCHECK_EQ(handle, m_handle.get());
501 515
502 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketReceiveHandshakeResponse", 516 if (document()) {
503 TRACE_EVENT_SCOPE_THREAD, "data", 517 TRACE_EVENT_INSTANT1(
504 InspectorWebSocketEvent::data(document(), m_identifier)); 518 "devtools.timeline", "WebSocketReceiveHandshakeResponse",
505 InspectorInstrumentation::didReceiveWebSocketHandshakeResponse( 519 TRACE_EVENT_SCOPE_THREAD, "data",
506 document(), m_identifier, m_handshakeRequest.get(), response); 520 InspectorWebSocketEvent::data(document(), m_identifier));
521 InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(
522 document(), m_identifier, m_handshakeRequest.get(), response);
523 }
507 m_handshakeRequest.clear(); 524 m_handshakeRequest.clear();
508 } 525 }
509 526
510 void DocumentWebSocketChannel::didFail(WebSocketHandle* handle, 527 void DocumentWebSocketChannel::didFail(WebSocketHandle* handle,
511 const String& message) { 528 const String& message) {
512 NETWORK_DVLOG(1) << this << " didFail(" << handle << ", " << String(message) 529 NETWORK_DVLOG(1) << this << " didFail(" << handle << ", " << String(message)
513 << ")"; 530 << ")";
514 531
515 connection_handle_for_scheduler_.reset(); 532 connection_handle_for_scheduler_.reset();
516 533
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 if (!fin) { 576 if (!fin) {
560 return; 577 return;
561 } 578 }
562 // FIXME: Change the inspector API to show the entire message instead 579 // FIXME: Change the inspector API to show the entire message instead
563 // of individual frames. 580 // of individual frames.
564 WebSocketFrame::OpCode opcode = m_receivingMessageTypeIsText 581 WebSocketFrame::OpCode opcode = m_receivingMessageTypeIsText
565 ? WebSocketFrame::OpCodeText 582 ? WebSocketFrame::OpCodeText
566 : WebSocketFrame::OpCodeBinary; 583 : WebSocketFrame::OpCodeBinary;
567 WebSocketFrame frame(opcode, m_receivingMessageData.data(), 584 WebSocketFrame frame(opcode, m_receivingMessageData.data(),
568 m_receivingMessageData.size(), WebSocketFrame::Final); 585 m_receivingMessageData.size(), WebSocketFrame::Final);
569 InspectorInstrumentation::didReceiveWebSocketFrame( 586 if (document()) {
570 document(), m_identifier, frame.opCode, frame.masked, frame.payload, 587 InspectorInstrumentation::didReceiveWebSocketFrame(
571 frame.payloadLength); 588 document(), m_identifier, frame.opCode, frame.masked, frame.payload,
589 frame.payloadLength);
590 }
572 if (m_receivingMessageTypeIsText) { 591 if (m_receivingMessageTypeIsText) {
573 String message = m_receivingMessageData.isEmpty() 592 String message = m_receivingMessageData.isEmpty()
574 ? emptyString 593 ? emptyString
575 : String::fromUTF8(m_receivingMessageData.data(), 594 : String::fromUTF8(m_receivingMessageData.data(),
576 m_receivingMessageData.size()); 595 m_receivingMessageData.size());
577 m_receivingMessageData.clear(); 596 m_receivingMessageData.clear();
578 if (message.isNull()) { 597 if (message.isNull()) {
579 failAsError("Could not decode a text frame as UTF-8."); 598 failAsError("Could not decode a text frame as UTF-8.");
580 // failAsError may delete this object. 599 // failAsError may delete this object.
581 } else { 600 } else {
(...skipping 14 matching lines...) Expand all
596 NETWORK_DVLOG(1) << this << " didClose(" << handle << ", " << wasClean << ", " 615 NETWORK_DVLOG(1) << this << " didClose(" << handle << ", " << wasClean << ", "
597 << code << ", " << String(reason) << ")"; 616 << code << ", " << String(reason) << ")";
598 617
599 connection_handle_for_scheduler_.reset(); 618 connection_handle_for_scheduler_.reset();
600 619
601 DCHECK(m_handle); 620 DCHECK(m_handle);
602 DCHECK_EQ(handle, m_handle.get()); 621 DCHECK_EQ(handle, m_handle.get());
603 622
604 m_handle.reset(); 623 m_handle.reset();
605 624
606 if (m_identifier) { 625 if (m_identifier && document()) {
607 TRACE_EVENT_INSTANT1( 626 TRACE_EVENT_INSTANT1(
608 "devtools.timeline", "WebSocketDestroy", TRACE_EVENT_SCOPE_THREAD, 627 "devtools.timeline", "WebSocketDestroy", TRACE_EVENT_SCOPE_THREAD,
609 "data", InspectorWebSocketEvent::data(document(), m_identifier)); 628 "data", InspectorWebSocketEvent::data(document(), m_identifier));
610 InspectorInstrumentation::didCloseWebSocket(document(), m_identifier); 629 InspectorInstrumentation::didCloseWebSocket(document(), m_identifier);
611 m_identifier = 0; 630 m_identifier = 0;
612 } 631 }
613 632
614 handleDidClose(wasClean, code, reason); 633 handleDidClose(wasClean, code, reason);
615 // handleDidClose may delete this object. 634 // handleDidClose may delete this object.
616 } 635 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } 678 }
660 // FIXME: Generate human-friendly reason message. 679 // FIXME: Generate human-friendly reason message.
661 failAsError("Failed to load Blob: error code = " + String::number(errorCode)); 680 failAsError("Failed to load Blob: error code = " + String::number(errorCode));
662 // |this| can be deleted here. 681 // |this| can be deleted here.
663 } 682 }
664 683
665 DEFINE_TRACE(DocumentWebSocketChannel) { 684 DEFINE_TRACE(DocumentWebSocketChannel) {
666 visitor->trace(m_blobLoader); 685 visitor->trace(m_blobLoader);
667 visitor->trace(m_messages); 686 visitor->trace(m_messages);
668 visitor->trace(m_client); 687 visitor->trace(m_client);
669 visitor->trace(m_document); 688 visitor->trace(m_loadingContext);
670 WebSocketChannel::trace(visitor); 689 WebSocketChannel::trace(visitor);
671 } 690 }
672 691
673 std::ostream& operator<<(std::ostream& ostream, 692 std::ostream& operator<<(std::ostream& ostream,
674 const DocumentWebSocketChannel* channel) { 693 const DocumentWebSocketChannel* channel) {
675 return ostream << "DocumentWebSocketChannel " 694 return ostream << "DocumentWebSocketChannel "
676 << static_cast<const void*>(channel); 695 << static_cast<const void*>(channel);
677 } 696 }
678 697
679 } // namespace blink 698 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698