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

Side by Side Diff: Source/modules/websockets/WebSocket.cpp

Issue 16385005: Avoid WebSocket::stop() being processed twice (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 } 482 }
483 483
484 void WebSocket::resume() 484 void WebSocket::resume()
485 { 485 {
486 if (m_channel) 486 if (m_channel)
487 m_channel->resume(); 487 m_channel->resume();
488 } 488 }
489 489
490 void WebSocket::stop() 490 void WebSocket::stop()
491 { 491 {
492 bool pending = hasPendingActivity(); 492 if (!hasPendingActivity())
tyoshino (SeeGerritForStatus) 2013/06/10 04:41:49 could you please insert ASSERT(!m_channel); here?
vivekg_samsung 2013/06/10 06:29:46 Yeah I will add it, thank you! How about also add
tyoshino (SeeGerritForStatus) 2013/06/10 08:49:46 Sounds good. Please :)
493 if (m_channel) 493 return;
494 if (m_channel) {
494 m_channel->disconnect(); 495 m_channel->disconnect();
495 m_channel = 0; 496 m_channel = 0;
497 }
496 m_state = CLOSED; 498 m_state = CLOSED;
497 ActiveDOMObject::stop(); 499 ActiveDOMObject::stop();
498 if (pending) 500 ActiveDOMObject::unsetPendingActivity(this);
499 ActiveDOMObject::unsetPendingActivity(this);
500 } 501 }
501 502
502 void WebSocket::didConnect() 503 void WebSocket::didConnect()
503 { 504 {
504 LOG(Network, "WebSocket %p didConnect()", this); 505 LOG(Network, "WebSocket %p didConnect()", this);
505 if (m_state != CONNECTING) 506 if (m_state != CONNECTING)
506 return; 507 return;
507 ASSERT(scriptExecutionContext()); 508 ASSERT(scriptExecutionContext());
508 m_state = OPEN; 509 m_state = OPEN;
509 m_subprotocol = m_channel->subprotocol(); 510 m_subprotocol = m_channel->subprotocol();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0 x10000; 600 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0 x10000;
600 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength; 601 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength;
601 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength) 602 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength)
602 overhead += 8; 603 overhead += 8;
603 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength) 604 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength)
604 overhead += 2; 605 overhead += 2;
605 return overhead; 606 return overhead;
606 } 607 }
607 608
608 } // namespace WebCore 609 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698