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

Side by Side Diff: third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 m_target->dispatchEvent(events.takeFirst()); 138 m_target->dispatchEvent(events.takeFirst());
139 // |this| can be stopped here. 139 // |this| can be stopped here.
140 } 140 }
141 if (m_state == Suspended) { 141 if (m_state == Suspended) {
142 while (!m_events.isEmpty()) 142 while (!m_events.isEmpty())
143 events.append(m_events.takeFirst()); 143 events.append(m_events.takeFirst());
144 events.swap(m_events); 144 events.swap(m_events);
145 } 145 }
146 } 146 }
147 147
148 void DOMWebSocket::EventQueue::resumeTimerFired(Timer<EventQueue>*) 148 void DOMWebSocket::EventQueue::resumeTimerFired(TimerBase*)
149 { 149 {
150 ASSERT(m_state == Suspended); 150 ASSERT(m_state == Suspended);
151 m_state = Active; 151 m_state = Active;
152 dispatchQueuedEvents(); 152 dispatchQueuedEvents();
153 } 153 }
154 154
155 DEFINE_TRACE(DOMWebSocket::EventQueue) 155 DEFINE_TRACE(DOMWebSocket::EventQueue)
156 { 156 {
157 visitor->trace(m_target); 157 visitor->trace(m_target);
158 visitor->trace(m_events); 158 visitor->trace(m_events);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 356 }
357 } 357 }
358 358
359 void DOMWebSocket::updateBufferedAmountAfterClose(uint64_t payloadSize) 359 void DOMWebSocket::updateBufferedAmountAfterClose(uint64_t payloadSize)
360 { 360 {
361 m_bufferedAmountAfterClose += payloadSize; 361 m_bufferedAmountAfterClose += payloadSize;
362 362
363 logError("WebSocket is already in CLOSING or CLOSED state."); 363 logError("WebSocket is already in CLOSING or CLOSED state.");
364 } 364 }
365 365
366 void DOMWebSocket::reflectBufferedAmountConsumption(Timer<DOMWebSocket>*) 366 void DOMWebSocket::reflectBufferedAmountConsumption(TimerBase*)
367 { 367 {
368 ASSERT(m_bufferedAmount >= m_consumedBufferedAmount); 368 ASSERT(m_bufferedAmount >= m_consumedBufferedAmount);
369 // Cast to unsigned long long is required since clang doesn't accept 369 // Cast to unsigned long long is required since clang doesn't accept
370 // combination of %llu and uint64_t (known as unsigned long). 370 // combination of %llu and uint64_t (known as unsigned long).
371 WTF_LOG(Network, "WebSocket %p reflectBufferedAmountConsumption() %llu => %l lu", this, static_cast<unsigned long long>(m_bufferedAmount), static_cast<unsign ed long long>(m_bufferedAmount - m_consumedBufferedAmount)); 371 WTF_LOG(Network, "WebSocket %p reflectBufferedAmountConsumption() %llu => %l lu", this, static_cast<unsigned long long>(m_bufferedAmount), static_cast<unsign ed long long>(m_bufferedAmount - m_consumedBufferedAmount));
372 372
373 m_bufferedAmount -= m_consumedBufferedAmount; 373 m_bufferedAmount -= m_consumedBufferedAmount;
374 m_consumedBufferedAmount = 0; 374 m_consumedBufferedAmount = 0;
375 } 375 }
376 376
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 DEFINE_TRACE(DOMWebSocket) 716 DEFINE_TRACE(DOMWebSocket)
717 { 717 {
718 visitor->trace(m_channel); 718 visitor->trace(m_channel);
719 visitor->trace(m_eventQueue); 719 visitor->trace(m_eventQueue);
720 WebSocketChannelClient::trace(visitor); 720 WebSocketChannelClient::trace(visitor);
721 EventTargetWithInlineData::trace(visitor); 721 EventTargetWithInlineData::trace(visitor);
722 ActiveDOMObject::trace(visitor); 722 ActiveDOMObject::trace(visitor);
723 } 723 }
724 724
725 } // namespace blink 725 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698