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

Unified Diff: Source/modules/websockets/DOMWebSocket.cpp

Issue 735433002: DOMWebSocket::bufferedAmount() should not return an "unsigned long" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/websockets/DOMWebSocket.h ('k') | Source/modules/websockets/DOMWebSocketTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/websockets/DOMWebSocket.cpp
diff --git a/Source/modules/websockets/DOMWebSocket.cpp b/Source/modules/websockets/DOMWebSocket.cpp
index 4ac91877ab57d6ddc6489c4b69561437e3c8307c..c3e55de38d799d22a79262ea3307aac5fe835f26 100644
--- a/Source/modules/websockets/DOMWebSocket.cpp
+++ b/Source/modules/websockets/DOMWebSocket.cpp
@@ -205,10 +205,10 @@ static String joinStrings(const Vector<String>& strings, const char* separator)
return builder.toString();
}
-static unsigned long saturateAdd(unsigned long a, unsigned long b)
+static unsigned saturateAdd(unsigned a, unsigned long b)
{
- if (std::numeric_limits<unsigned long>::max() - a < b)
- return std::numeric_limits<unsigned long>::max();
+ if (std::numeric_limits<unsigned>::max() - a < b)
+ return std::numeric_limits<unsigned>::max();
return a + b;
}
@@ -360,7 +360,7 @@ void DOMWebSocket::updateBufferedAmountAfterClose(unsigned long payloadSize)
void DOMWebSocket::reflectBufferedAmountConsumption(Timer<DOMWebSocket>*)
{
ASSERT(m_bufferedAmount >= m_consumedBufferedAmount);
- WTF_LOG(Network, "WebSocket %p reflectBufferedAmountConsumption() %lu => %lu", this, m_bufferedAmount, m_bufferedAmount - m_consumedBufferedAmount);
+ WTF_LOG(Network, "WebSocket %p reflectBufferedAmountConsumption() %u => %u", this, m_bufferedAmount, m_bufferedAmount - m_consumedBufferedAmount);
m_bufferedAmount -= m_consumedBufferedAmount;
m_consumedBufferedAmount = 0;
@@ -500,7 +500,7 @@ DOMWebSocket::State DOMWebSocket::readyState() const
return m_state;
}
-unsigned long DOMWebSocket::bufferedAmount() const
+unsigned DOMWebSocket::bufferedAmount() const
{
return saturateAdd(m_bufferedAmount, m_bufferedAmountAfterClose);
}
@@ -641,10 +641,10 @@ void DOMWebSocket::didError()
m_eventQueue->dispatch(Event::create(EventTypeNames::error));
}
-void DOMWebSocket::didConsumeBufferedAmount(unsigned long consumed)
+void DOMWebSocket::didConsumeBufferedAmount(unsigned consumed)
{
ASSERT(m_bufferedAmount >= consumed);
- WTF_LOG(Network, "WebSocket %p didConsumeBufferedAmount(%lu)", this, consumed);
+ WTF_LOG(Network, "WebSocket %p didConsumeBufferedAmount(%u)", this, consumed);
if (m_state == CLOSED)
return;
m_consumedBufferedAmount += consumed;
« no previous file with comments | « Source/modules/websockets/DOMWebSocket.h ('k') | Source/modules/websockets/DOMWebSocketTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698