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

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

Issue 26878003: Reduce repetitive EventTarget subclassing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nit Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/websockets/WebSocket.h ('k') | 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 } 610 }
611 611
612 if (m_channel) { 612 if (m_channel) {
613 m_channel->disconnect(); 613 m_channel->disconnect();
614 m_channel = 0; 614 m_channel = 0;
615 } 615 }
616 if (hasPendingActivity()) 616 if (hasPendingActivity())
617 ActiveDOMObject::unsetPendingActivity(this); 617 ActiveDOMObject::unsetPendingActivity(this);
618 } 618 }
619 619
620 EventTargetData* WebSocket::eventTargetData()
621 {
622 return &m_eventTargetData;
623 }
624
625 EventTargetData* WebSocket::ensureEventTargetData()
626 {
627 return &m_eventTargetData;
628 }
629
630 size_t WebSocket::getFramingOverhead(size_t payloadSize) 620 size_t WebSocket::getFramingOverhead(size_t payloadSize)
631 { 621 {
632 static const size_t hybiBaseFramingOverhead = 2; // Every frame has at least two-byte header. 622 static const size_t hybiBaseFramingOverhead = 2; // Every frame has at least two-byte header.
633 static const size_t hybiMaskingKeyLength = 4; // Every frame from client mus t have masking key. 623 static const size_t hybiMaskingKeyLength = 4; // Every frame from client mus t have masking key.
634 static const size_t minimumPayloadSizeWithTwoByteExtendedPayloadLength = 126 ; 624 static const size_t minimumPayloadSizeWithTwoByteExtendedPayloadLength = 126 ;
635 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0 x10000; 625 static const size_t minimumPayloadSizeWithEightByteExtendedPayloadLength = 0 x10000;
636 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength; 626 size_t overhead = hybiBaseFramingOverhead + hybiMaskingKeyLength;
637 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength) 627 if (payloadSize >= minimumPayloadSizeWithEightByteExtendedPayloadLength)
638 overhead += 8; 628 overhead += 8;
639 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength) 629 else if (payloadSize >= minimumPayloadSizeWithTwoByteExtendedPayloadLength)
640 overhead += 2; 630 overhead += 2;
641 return overhead; 631 return overhead;
642 } 632 }
643 633
644 } // namespace WebCore 634 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/websockets/WebSocket.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698