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

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

Issue 311993006: [WebSocket] bufferedAmount should not decrease inside a task. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 if (m_shouldDiscardReceivedData) 348 if (m_shouldDiscardReceivedData)
349 return; 349 return;
350 if (!appendToBuffer(data, len)) { 350 if (!appendToBuffer(data, len)) {
351 m_shouldDiscardReceivedData = true; 351 m_shouldDiscardReceivedData = true;
352 failAsError("Ran out of memory while receiving WebSocket data."); 352 failAsError("Ran out of memory while receiving WebSocket data.");
353 return; 353 return;
354 } 354 }
355 processBuffer(); 355 processBuffer();
356 } 356 }
357 357
358 void MainThreadWebSocketChannel::didUpdateBufferedAmount(SocketStreamHandle*, si ze_t bufferedAmount) 358 void MainThreadWebSocketChannel::didIncreaseBufferedAmount(SocketStreamHandle*, size_t amount)
359 { 359 {
360 if (m_client) 360 if (m_client)
361 m_client->didUpdateBufferedAmount(bufferedAmount); 361 m_client->didIncreaseBufferedAmount(amount);
362 }
363
364 void MainThreadWebSocketChannel::didDecreaseBufferedAmount(SocketStreamHandle*, size_t amount)
365 {
366 if (m_client)
367 m_client->didDecreaseBufferedAmount(amount);
362 } 368 }
363 369
364 void MainThreadWebSocketChannel::didFailSocketStream(SocketStreamHandle* handle, const SocketStreamError& error) 370 void MainThreadWebSocketChannel::didFailSocketStream(SocketStreamHandle* handle, const SocketStreamError& error)
365 { 371 {
366 WTF_LOG(Network, "MainThreadWebSocketChannel %p didFailSocketStream()", this ); 372 WTF_LOG(Network, "MainThreadWebSocketChannel %p didFailSocketStream()", this );
367 ASSERT_UNUSED(handle, handle == m_handle || !m_handle); 373 ASSERT_UNUSED(handle, handle == m_handle || !m_handle);
368 m_shouldDiscardReceivedData = true; 374 m_shouldDiscardReceivedData = true;
369 String message; 375 String message;
370 if (error.isNull()) 376 if (error.isNull())
371 message = "WebSocket network error"; 377 message = "WebSocket network error";
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 } 870 }
865 871
866 Vector<char> frameData; 872 Vector<char> frameData;
867 frame.makeFrameData(frameData); 873 frame.makeFrameData(frameData);
868 874
869 m_perMessageDeflate.resetDeflateBuffer(); 875 m_perMessageDeflate.resetDeflateBuffer();
870 return m_handle->send(frameData.data(), frameData.size()); 876 return m_handle->send(frameData.data(), frameData.size());
871 } 877 }
872 878
873 } // namespace WebCore 879 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698