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

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

Issue 2939123002: Revert of Add blink::WebSocketHandshakeThrottle (Closed)
Patch Set: Created 3 years, 6 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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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 "core/dom/DOMArrayBuffer.h" 34 #include "core/dom/DOMArrayBuffer.h"
34 #include "core/dom/ExecutionContext.h" 35 #include "core/dom/ExecutionContext.h"
35 #include "core/dom/TaskRunnerHelper.h" 36 #include "core/dom/TaskRunnerHelper.h"
36 #include "core/fileapi/FileReaderLoader.h" 37 #include "core/fileapi/FileReaderLoader.h"
37 #include "core/fileapi/FileReaderLoaderClient.h" 38 #include "core/fileapi/FileReaderLoaderClient.h"
38 #include "core/frame/LocalFrame.h" 39 #include "core/frame/LocalFrame.h"
39 #include "core/frame/LocalFrameClient.h" 40 #include "core/frame/LocalFrameClient.h"
40 #include "core/frame/WebLocalFrameBase.h"
41 #include "core/inspector/ConsoleMessage.h" 41 #include "core/inspector/ConsoleMessage.h"
42 #include "core/loader/DocumentLoader.h" 42 #include "core/loader/DocumentLoader.h"
43 #include "core/loader/FrameLoader.h" 43 #include "core/loader/FrameLoader.h"
44 #include "core/loader/MixedContentChecker.h" 44 #include "core/loader/MixedContentChecker.h"
45 #include "core/loader/SubresourceFilter.h" 45 #include "core/loader/SubresourceFilter.h"
46 #include "core/loader/ThreadableLoadingContext.h" 46 #include "core/loader/ThreadableLoadingContext.h"
47 #include "core/page/ChromeClient.h"
48 #include "core/page/Page.h"
49 #include "core/probe/CoreProbes.h" 47 #include "core/probe/CoreProbes.h"
50 #include "modules/websockets/InspectorWebSocketEvents.h" 48 #include "modules/websockets/InspectorWebSocketEvents.h"
51 #include "modules/websockets/WebSocketChannelClient.h" 49 #include "modules/websockets/WebSocketChannelClient.h"
52 #include "modules/websockets/WebSocketFrame.h" 50 #include "modules/websockets/WebSocketFrame.h"
53 #include "modules/websockets/WebSocketHandleImpl.h" 51 #include "modules/websockets/WebSocketHandleImpl.h"
54 #include "platform/WebFrameScheduler.h" 52 #include "platform/WebFrameScheduler.h"
55 #include "platform/WebTaskRunner.h" 53 #include "platform/WebTaskRunner.h"
56 #include "platform/loader/fetch/UniqueIdentifier.h" 54 #include "platform/loader/fetch/UniqueIdentifier.h"
57 #include "platform/network/NetworkLog.h" 55 #include "platform/network/NetworkLog.h"
58 #include "platform/network/WebSocketHandshakeRequest.h" 56 #include "platform/network/WebSocketHandshakeRequest.h"
59 #include "platform/weborigin/SecurityOrigin.h" 57 #include "platform/weborigin/SecurityOrigin.h"
60 #include "platform/wtf/Functional.h" 58 #include "platform/wtf/Functional.h"
61 #include "platform/wtf/PtrUtil.h" 59 #include "platform/wtf/PtrUtil.h"
62 #include "public/platform/InterfaceProvider.h" 60 #include "public/platform/InterfaceProvider.h"
63 #include "public/platform/Platform.h" 61 #include "public/platform/Platform.h"
64 #include "public/platform/WebSocketHandshakeThrottle.h"
65 #include "public/platform/WebTraceLocation.h" 62 #include "public/platform/WebTraceLocation.h"
66 #include "public/platform/WebURL.h"
67 63
68 namespace blink { 64 namespace blink {
69 65
70 class DocumentWebSocketChannel::BlobLoader final 66 class DocumentWebSocketChannel::BlobLoader final
71 : public GarbageCollectedFinalized<DocumentWebSocketChannel::BlobLoader>, 67 : public GarbageCollectedFinalized<DocumentWebSocketChannel::BlobLoader>,
72 public FileReaderLoaderClient { 68 public FileReaderLoaderClient {
73 public: 69 public:
74 BlobLoader(PassRefPtr<BlobDataHandle>, DocumentWebSocketChannel*); 70 BlobLoader(PassRefPtr<BlobDataHandle>, DocumentWebSocketChannel*);
75 ~BlobLoader() override {} 71 ~BlobLoader() override {}
76 72
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 channel_->DidFinishLoadingBlob(loader_->ArrayBufferResult()); 128 channel_->DidFinishLoadingBlob(loader_->ArrayBufferResult());
133 // |this| is deleted here. 129 // |this| is deleted here.
134 } 130 }
135 131
136 void DocumentWebSocketChannel::BlobLoader::DidFail( 132 void DocumentWebSocketChannel::BlobLoader::DidFail(
137 FileError::ErrorCode error_code) { 133 FileError::ErrorCode error_code) {
138 channel_->DidFailLoadingBlob(error_code); 134 channel_->DidFailLoadingBlob(error_code);
139 // |this| is deleted here. 135 // |this| is deleted here.
140 } 136 }
141 137
142 struct DocumentWebSocketChannel::ConnectInfo {
143 ConnectInfo(const String& selected_protocol, const String& extensions)
144 : selected_protocol(selected_protocol), extensions(extensions) {}
145
146 const String selected_protocol;
147 const String extensions;
148 };
149
150 // static
151 DocumentWebSocketChannel* DocumentWebSocketChannel::CreateForTesting(
152 Document* document,
153 WebSocketChannelClient* client,
154 std::unique_ptr<SourceLocation> location,
155 WebSocketHandle* handle,
156 std::unique_ptr<WebSocketHandshakeThrottle> handshake_throttle) {
157 return new DocumentWebSocketChannel(
158 ThreadableLoadingContext::Create(*document), client, std::move(location),
159 WTF::WrapUnique(handle), std::move(handshake_throttle));
160 }
161
162 // static
163 DocumentWebSocketChannel* DocumentWebSocketChannel::Create(
164 ThreadableLoadingContext* loading_context,
165 WebSocketChannelClient* client,
166 std::unique_ptr<SourceLocation> location) {
167 return new DocumentWebSocketChannel(
168 loading_context, client, std::move(location),
169 WTF::MakeUnique<WebSocketHandleImpl>(),
170 Platform::Current()->CreateWebSocketHandshakeThrottle());
171 }
172
173 DocumentWebSocketChannel::DocumentWebSocketChannel( 138 DocumentWebSocketChannel::DocumentWebSocketChannel(
174 ThreadableLoadingContext* loading_context, 139 ThreadableLoadingContext* loading_context,
175 WebSocketChannelClient* client, 140 WebSocketChannelClient* client,
176 std::unique_ptr<SourceLocation> location, 141 std::unique_ptr<SourceLocation> location,
177 std::unique_ptr<WebSocketHandle> handle, 142 WebSocketHandle* handle)
178 std::unique_ptr<WebSocketHandshakeThrottle> handshake_throttle) 143 : handle_(WTF::WrapUnique(handle ? handle : new WebSocketHandleImpl())),
179 : handle_(std::move(handle)),
180 client_(client), 144 client_(client),
181 identifier_(CreateUniqueIdentifier()), 145 identifier_(CreateUniqueIdentifier()),
182 loading_context_(loading_context), 146 loading_context_(loading_context),
183 sending_quota_(0), 147 sending_quota_(0),
184 received_data_size_for_flow_control_( 148 received_data_size_for_flow_control_(
185 kReceivedDataSizeForFlowControlHighWaterMark * 2), // initial quota 149 kReceivedDataSizeForFlowControlHighWaterMark * 2), // initial quota
186 sent_size_of_top_message_(0), 150 sent_size_of_top_message_(0),
187 location_at_construction_(std::move(location)), 151 location_at_construction_(std::move(location)) {}
188 handshake_throttle_(std::move(handshake_throttle)),
189 throttle_passed_(false) {}
190 152
191 DocumentWebSocketChannel::~DocumentWebSocketChannel() { 153 DocumentWebSocketChannel::~DocumentWebSocketChannel() {
192 DCHECK(!blob_loader_); 154 DCHECK(!blob_loader_);
193 } 155 }
194 156
195 bool DocumentWebSocketChannel::Connect(const KURL& url, 157 bool DocumentWebSocketChannel::Connect(const KURL& url,
196 const String& protocol) { 158 const String& protocol) {
197 NETWORK_DVLOG(1) << this << " connect()"; 159 NETWORK_DVLOG(1) << this << " connect()";
198 if (!handle_) 160 if (!handle_)
199 return false; 161 return false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // This is important so that the browser can show UI associated with 215 // This is important so that the browser can show UI associated with
254 // the WebSocket (e.g., for certificate errors). 216 // the WebSocket (e.g., for certificate errors).
255 handle_->Initialize(GetDocument()->GetFrame()->GetInterfaceProvider()); 217 handle_->Initialize(GetDocument()->GetFrame()->GetInterfaceProvider());
256 } else { 218 } else {
257 handle_->Initialize(Platform::Current()->GetInterfaceProvider()); 219 handle_->Initialize(Platform::Current()->GetInterfaceProvider());
258 } 220 }
259 handle_->Connect(url, protocols, loading_context_->GetSecurityOrigin(), 221 handle_->Connect(url, protocols, loading_context_->GetSecurityOrigin(),
260 loading_context_->FirstPartyForCookies(), 222 loading_context_->FirstPartyForCookies(),
261 loading_context_->UserAgent(), this); 223 loading_context_->UserAgent(), this);
262 224
263 // TODO(ricea): Maybe lookup GetDocument()->GetFrame() less often?
264 if (handshake_throttle_ && GetDocument() && GetDocument()->GetFrame() &&
265 GetDocument()->GetFrame()->GetPage()) {
266 // TODO(ricea): We may need to do something special here for SharedWorkers
267 // and ServiceWorkers
268 // TODO(ricea): Figure out who owns this WebFrame object and how long it can
269 // be expected to live.
270 LocalFrame* frame = GetDocument()->GetFrame();
271 WebLocalFrame* web_frame =
272 frame->GetPage()->GetChromeClient().GetWebLocalFrameBase(frame);
273 handshake_throttle_->ThrottleHandshake(url, web_frame, this);
274 } else {
275 // Treat no throttle as success.
276 throttle_passed_ = true;
277 }
278
279 FlowControlIfNecessary(); 225 FlowControlIfNecessary();
280 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketCreate", 226 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketCreate",
281 TRACE_EVENT_SCOPE_THREAD, "data", 227 TRACE_EVENT_SCOPE_THREAD, "data",
282 InspectorWebSocketCreateEvent::Data( 228 InspectorWebSocketCreateEvent::Data(
283 GetDocument(), identifier_, url, protocol)); 229 GetDocument(), identifier_, url, protocol));
284 probe::didCreateWebSocket(GetDocument(), identifier_, url, protocol); 230 probe::didCreateWebSocket(GetDocument(), identifier_, url, protocol);
285 return true; 231 return true;
286 } 232 }
287 233
288 void DocumentWebSocketChannel::Send(const CString& message) { 234 void DocumentWebSocketChannel::Send(const CString& message) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 void DocumentWebSocketChannel::Disconnect() { 334 void DocumentWebSocketChannel::Disconnect() {
389 NETWORK_DVLOG(1) << this << " disconnect()"; 335 NETWORK_DVLOG(1) << this << " disconnect()";
390 if (identifier_) { 336 if (identifier_) {
391 TRACE_EVENT_INSTANT1( 337 TRACE_EVENT_INSTANT1(
392 "devtools.timeline", "WebSocketDestroy", TRACE_EVENT_SCOPE_THREAD, 338 "devtools.timeline", "WebSocketDestroy", TRACE_EVENT_SCOPE_THREAD,
393 "data", InspectorWebSocketEvent::Data(GetDocument(), identifier_)); 339 "data", InspectorWebSocketEvent::Data(GetDocument(), identifier_));
394 probe::didCloseWebSocket(GetDocument(), identifier_); 340 probe::didCloseWebSocket(GetDocument(), identifier_);
395 } 341 }
396 connection_handle_for_scheduler_.reset(); 342 connection_handle_for_scheduler_.reset();
397 AbortAsyncOperations(); 343 AbortAsyncOperations();
398 handshake_throttle_.reset();
399 handle_.reset(); 344 handle_.reset();
400 client_ = nullptr; 345 client_ = nullptr;
401 identifier_ = 0; 346 identifier_ = 0;
402 } 347 }
403 348
404 DocumentWebSocketChannel::Message::Message(const CString& text) 349 DocumentWebSocketChannel::Message::Message(const CString& text)
405 : type(kMessageTypeText), text(text) {} 350 : type(kMessageTypeText), text(text) {}
406 351
407 DocumentWebSocketChannel::Message::Message( 352 DocumentWebSocketChannel::Message::Message(
408 PassRefPtr<BlobDataHandle> blob_data_handle) 353 PassRefPtr<BlobDataHandle> blob_data_handle)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 break; 426 break;
482 case kMessageTypeBinaryAsCharVector: 427 case kMessageTypeBinaryAsCharVector:
483 SendInternal(WebSocketHandle::kMessageTypeBinary, 428 SendInternal(WebSocketHandle::kMessageTypeBinary,
484 message->vector_data->data(), message->vector_data->size(), 429 message->vector_data->data(), message->vector_data->size(),
485 &consumed_buffered_amount); 430 &consumed_buffered_amount);
486 break; 431 break;
487 case kMessageTypeClose: { 432 case kMessageTypeClose: {
488 // No message should be sent from now on. 433 // No message should be sent from now on.
489 DCHECK_EQ(messages_.size(), 1u); 434 DCHECK_EQ(messages_.size(), 1u);
490 DCHECK_EQ(sent_size_of_top_message_, 0u); 435 DCHECK_EQ(sent_size_of_top_message_, 0u);
491 handshake_throttle_.reset();
492 handle_->Close(message->code, message->reason); 436 handle_->Close(message->code, message->reason);
493 messages_.pop_front(); 437 messages_.pop_front();
494 break; 438 break;
495 } 439 }
496 } 440 }
497 } 441 }
498 if (client_ && consumed_buffered_amount > 0) 442 if (client_ && consumed_buffered_amount > 0)
499 client_->DidConsumeBufferedAmount(consumed_buffered_amount); 443 client_->DidConsumeBufferedAmount(consumed_buffered_amount);
500 } 444 }
501 445
502 void DocumentWebSocketChannel::FlowControlIfNecessary() { 446 void DocumentWebSocketChannel::FlowControlIfNecessary() {
503 if (!handle_ || received_data_size_for_flow_control_ < 447 if (!handle_ || received_data_size_for_flow_control_ <
504 kReceivedDataSizeForFlowControlHighWaterMark) { 448 kReceivedDataSizeForFlowControlHighWaterMark) {
505 return; 449 return;
506 } 450 }
507 handle_->FlowControl(received_data_size_for_flow_control_); 451 handle_->FlowControl(received_data_size_for_flow_control_);
508 received_data_size_for_flow_control_ = 0; 452 received_data_size_for_flow_control_ = 0;
509 } 453 }
510 454
511 void DocumentWebSocketChannel::AbortAsyncOperations() { 455 void DocumentWebSocketChannel::AbortAsyncOperations() {
512 if (blob_loader_) { 456 if (blob_loader_) {
513 blob_loader_->Cancel(); 457 blob_loader_->Cancel();
514 blob_loader_.Clear(); 458 blob_loader_.Clear();
515 } 459 }
516 } 460 }
517 461
518 void DocumentWebSocketChannel::HandleDidClose(bool was_clean, 462 void DocumentWebSocketChannel::HandleDidClose(bool was_clean,
519 unsigned short code, 463 unsigned short code,
520 const String& reason) { 464 const String& reason) {
521 handshake_throttle_.reset();
522 handle_.reset(); 465 handle_.reset();
523 AbortAsyncOperations(); 466 AbortAsyncOperations();
524 if (!client_) { 467 if (!client_) {
525 return; 468 return;
526 } 469 }
527 WebSocketChannelClient* client = client_; 470 WebSocketChannelClient* client = client_;
528 client_ = nullptr; 471 client_ = nullptr;
529 WebSocketChannelClient::ClosingHandshakeCompletionStatus status = 472 WebSocketChannelClient::ClosingHandshakeCompletionStatus status =
530 was_clean ? WebSocketChannelClient::kClosingHandshakeComplete 473 was_clean ? WebSocketChannelClient::kClosingHandshakeComplete
531 : WebSocketChannelClient::kClosingHandshakeIncomplete; 474 : WebSocketChannelClient::kClosingHandshakeIncomplete;
(...skipping 13 matching lines...) Expand all
545 const String& selected_protocol, 488 const String& selected_protocol,
546 const String& extensions) { 489 const String& extensions) {
547 NETWORK_DVLOG(1) << this << " didConnect(" << handle << ", " 490 NETWORK_DVLOG(1) << this << " didConnect(" << handle << ", "
548 << String(selected_protocol) << ", " << String(extensions) 491 << String(selected_protocol) << ", " << String(extensions)
549 << ")"; 492 << ")";
550 493
551 DCHECK(handle_); 494 DCHECK(handle_);
552 DCHECK_EQ(handle, handle_.get()); 495 DCHECK_EQ(handle, handle_.get());
553 DCHECK(client_); 496 DCHECK(client_);
554 497
555 if (!throttle_passed_) {
556 connect_info_ = WTF::MakeUnique<ConnectInfo>(selected_protocol, extensions);
557 return;
558 }
559
560 handshake_throttle_.reset();
561
562 client_->DidConnect(selected_protocol, extensions); 498 client_->DidConnect(selected_protocol, extensions);
563 } 499 }
564 500
565 void DocumentWebSocketChannel::DidStartOpeningHandshake( 501 void DocumentWebSocketChannel::DidStartOpeningHandshake(
566 WebSocketHandle* handle, 502 WebSocketHandle* handle,
567 PassRefPtr<WebSocketHandshakeRequest> request) { 503 PassRefPtr<WebSocketHandshakeRequest> request) {
568 NETWORK_DVLOG(1) << this << " didStartOpeningHandshake(" << handle << ")"; 504 NETWORK_DVLOG(1) << this << " didStartOpeningHandshake(" << handle << ")";
569 505
570 DCHECK(handle_); 506 DCHECK(handle_);
571 DCHECK_EQ(handle, handle_.get()); 507 DCHECK_EQ(handle, handle_.get());
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 WebSocketHandle* handle) { 663 WebSocketHandle* handle) {
728 NETWORK_DVLOG(1) << this << " didStartClosingHandshake(" << handle << ")"; 664 NETWORK_DVLOG(1) << this << " didStartClosingHandshake(" << handle << ")";
729 665
730 DCHECK(handle_); 666 DCHECK(handle_);
731 DCHECK_EQ(handle, handle_.get()); 667 DCHECK_EQ(handle, handle_.get());
732 668
733 if (client_) 669 if (client_)
734 client_->DidStartClosingHandshake(); 670 client_->DidStartClosingHandshake();
735 } 671 }
736 672
737 void DocumentWebSocketChannel::OnSuccess() {
738 DCHECK(!throttle_passed_);
739 DCHECK(handshake_throttle_);
740 throttle_passed_ = true;
741 handshake_throttle_ = nullptr;
742 if (connect_info_) {
743 client_->DidConnect(std::move(connect_info_->selected_protocol),
744 std::move(connect_info_->extensions));
745 connect_info_.reset();
746 }
747 }
748
749 void DocumentWebSocketChannel::OnError(const WebString& console_message) {
750 DCHECK(!throttle_passed_);
751 DCHECK(handshake_throttle_);
752 handshake_throttle_ = nullptr;
753 FailAsError(console_message);
754 }
755
756 void DocumentWebSocketChannel::DidFinishLoadingBlob(DOMArrayBuffer* buffer) { 673 void DocumentWebSocketChannel::DidFinishLoadingBlob(DOMArrayBuffer* buffer) {
757 blob_loader_.Clear(); 674 blob_loader_.Clear();
758 DCHECK(handle_); 675 DCHECK(handle_);
759 // The loaded blob is always placed on m_messages[0]. 676 // The loaded blob is always placed on m_messages[0].
760 DCHECK_GT(messages_.size(), 0u); 677 DCHECK_GT(messages_.size(), 0u);
761 DCHECK_EQ(messages_.front()->type, kMessageTypeBlob); 678 DCHECK_EQ(messages_.front()->type, kMessageTypeBlob);
762 // We replace it with the loaded blob. 679 // We replace it with the loaded blob.
763 messages_.front() = new Message(buffer); 680 messages_.front() = new Message(buffer);
764 ProcessSendQueue(); 681 ProcessSendQueue();
765 } 682 }
766 683
767 void DocumentWebSocketChannel::DidFailLoadingBlob( 684 void DocumentWebSocketChannel::DidFailLoadingBlob(
768 FileError::ErrorCode error_code) { 685 FileError::ErrorCode error_code) {
769 blob_loader_.Clear(); 686 blob_loader_.Clear();
770 if (error_code == FileError::kAbortErr) { 687 if (error_code == FileError::kAbortErr) {
771 // The error is caused by cancel(). 688 // The error is caused by cancel().
772 return; 689 return;
773 } 690 }
774 // FIXME: Generate human-friendly reason message. 691 // FIXME: Generate human-friendly reason message.
775 FailAsError("Failed to load Blob: error code = " + 692 FailAsError("Failed to load Blob: error code = " +
776 String::Number(error_code)); 693 String::Number(error_code));
777 // |this| can be deleted here. 694 // |this| can be deleted here.
778 } 695 }
779 696
780 void DocumentWebSocketChannel::TearDownFailedConnection() { 697 void DocumentWebSocketChannel::TearDownFailedConnection() {
781 // m_handle and m_client can be null here. 698 // m_handle and m_client can be null here.
782 connection_handle_for_scheduler_.reset(); 699 connection_handle_for_scheduler_.reset();
783 handshake_throttle_.reset();
784 700
785 if (client_) 701 if (client_)
786 client_->DidError(); 702 client_->DidError();
787 703
788 HandleDidClose(false, kCloseEventCodeAbnormalClosure, String()); 704 HandleDidClose(false, kCloseEventCodeAbnormalClosure, String());
789 // handleDidClose may delete this object. 705 // handleDidClose may delete this object.
790 } 706 }
791 707
792 bool DocumentWebSocketChannel::ShouldDisallowConnection(const KURL& url) { 708 bool DocumentWebSocketChannel::ShouldDisallowConnection(const KURL& url) {
793 DCHECK(handle_); 709 DCHECK(handle_);
(...skipping 14 matching lines...) Expand all
808 WebSocketChannel::Trace(visitor); 724 WebSocketChannel::Trace(visitor);
809 } 725 }
810 726
811 std::ostream& operator<<(std::ostream& ostream, 727 std::ostream& operator<<(std::ostream& ostream,
812 const DocumentWebSocketChannel* channel) { 728 const DocumentWebSocketChannel* channel) {
813 return ostream << "DocumentWebSocketChannel " 729 return ostream << "DocumentWebSocketChannel "
814 << static_cast<const void*>(channel); 730 << static_cast<const void*>(channel);
815 } 731 }
816 732
817 } // namespace blink 733 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698