| 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 14 matching lines...) Expand all Loading... |
| 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 "config.h" | 31 #include "config.h" |
| 32 | 32 |
| 33 #include "modules/websockets/WebSocketPerMessageDeflate.h" | 33 #include "modules/websockets/WebSocketPerMessageDeflate.h" |
| 34 | 34 |
| 35 #include "core/platform/HistogramSupport.h" |
| 35 #include "modules/websockets/WebSocketExtensionParser.h" | 36 #include "modules/websockets/WebSocketExtensionParser.h" |
| 36 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
| 37 #include "wtf/text/CString.h" | 38 #include "wtf/text/CString.h" |
| 38 #include "wtf/text/StringHash.h" | 39 #include "wtf/text/StringHash.h" |
| 39 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 40 | 41 |
| 41 namespace WebCore { | 42 namespace WebCore { |
| 42 | 43 |
| 43 class CompressionMessageExtensionProcessor : public WebSocketExtensionProcessor
{ | 44 class CompressionMessageExtensionProcessor : public WebSocketExtensionProcessor
{ |
| 44 WTF_MAKE_FAST_ALLOCATED; | 45 WTF_MAKE_FAST_ALLOCATED; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 m_failureReason = "Received invalid c2s_max_window_bits parameter"; | 110 m_failureReason = "Received invalid c2s_max_window_bits parameter"; |
| 110 return false; | 111 return false; |
| 111 } | 112 } |
| 112 ++numProcessedParameters; | 113 ++numProcessedParameters; |
| 113 } | 114 } |
| 114 | 115 |
| 115 if (numProcessedParameters != parameters.size()) { | 116 if (numProcessedParameters != parameters.size()) { |
| 116 m_failureReason = "Received an unexpected permessage-deflate extension p
arameter"; | 117 m_failureReason = "Received an unexpected permessage-deflate extension p
arameter"; |
| 117 return false; | 118 return false; |
| 118 } | 119 } |
| 120 HistogramSupport::histogramEnumeration("WebCore.WebSocket.PerMessageDeflateC
ontextTakeOverMode", mode, WebSocketDeflater::ContextTakeOverModeMax); |
| 119 m_compress.enable(windowBits, mode); | 121 m_compress.enable(windowBits, mode); |
| 120 return true; | 122 return true; |
| 121 } | 123 } |
| 122 | 124 |
| 123 WebSocketPerMessageDeflate::WebSocketPerMessageDeflate() | 125 WebSocketPerMessageDeflate::WebSocketPerMessageDeflate() |
| 124 : m_enabled(false) | 126 : m_enabled(false) |
| 125 , m_deflateOngoing(false) | 127 , m_deflateOngoing(false) |
| 126 , m_inflateOngoing(false) | 128 , m_inflateOngoing(false) |
| 127 { | 129 { |
| 128 } | 130 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 m_inflater->reset(); | 228 m_inflater->reset(); |
| 227 } | 229 } |
| 228 | 230 |
| 229 void WebSocketPerMessageDeflate::didFail() | 231 void WebSocketPerMessageDeflate::didFail() |
| 230 { | 232 { |
| 231 resetDeflateBuffer(); | 233 resetDeflateBuffer(); |
| 232 resetInflateBuffer(); | 234 resetInflateBuffer(); |
| 233 } | 235 } |
| 234 | 236 |
| 235 } // namespace WebCore | 237 } // namespace WebCore |
| OLD | NEW |