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

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

Issue 27571005: Replace Timers used in ActiveDOMObject with AsyncMethodRunner (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 20 matching lines...) Expand all
31 #ifndef WebSocket_h 31 #ifndef WebSocket_h
32 #define WebSocket_h 32 #define WebSocket_h
33 33
34 #include "bindings/v8/ScriptWrappable.h" 34 #include "bindings/v8/ScriptWrappable.h"
35 #include "core/dom/ActiveDOMObject.h" 35 #include "core/dom/ActiveDOMObject.h"
36 #include "core/events/EventListener.h" 36 #include "core/events/EventListener.h"
37 #include "core/events/EventTarget.h" 37 #include "core/events/EventTarget.h"
38 #include "core/events/ThreadLocalEventNames.h" 38 #include "core/events/ThreadLocalEventNames.h"
39 #include "modules/websockets/WebSocketChannel.h" 39 #include "modules/websockets/WebSocketChannel.h"
40 #include "modules/websockets/WebSocketChannelClient.h" 40 #include "modules/websockets/WebSocketChannelClient.h"
41 #include "platform/Timer.h" 41 #include "platform/AsyncMethodRunner.h"
42 #include "weborigin/KURL.h" 42 #include "weborigin/KURL.h"
43 #include "wtf/Forward.h" 43 #include "wtf/Forward.h"
44 #include "wtf/OwnPtr.h" 44 #include "wtf/OwnPtr.h"
45 #include "wtf/RefCounted.h" 45 #include "wtf/RefCounted.h"
46 #include "wtf/text/AtomicStringHash.h" 46 #include "wtf/text/AtomicStringHash.h"
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
50 class Blob; 50 class Blob;
51 class ExceptionState; 51 class ExceptionState;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 virtual void didClose(unsigned long unhandledBufferedAmount, ClosingHandshak eCompletionStatus, unsigned short code, const String& reason) OVERRIDE; 119 virtual void didClose(unsigned long unhandledBufferedAmount, ClosingHandshak eCompletionStatus, unsigned short code, const String& reason) OVERRIDE;
120 120
121 private: 121 private:
122 explicit WebSocket(ExecutionContext*); 122 explicit WebSocket(ExecutionContext*);
123 123
124 // Handle the JavaScript close method call. close() methods on this class 124 // Handle the JavaScript close method call. close() methods on this class
125 // are just for determining if the optional code argument is supplied or 125 // are just for determining if the optional code argument is supplied or
126 // not. 126 // not.
127 void closeInternal(int, const String&, ExceptionState&); 127 void closeInternal(int, const String&, ExceptionState&);
128 128
129 // Calls unsetPendingActivity(). Used for m_timerForDeferredDropProtection 129 // Calls unsetPendingActivity(). Used with m_dropProtectionRunner to drop
130 // to drop the reference for protection asynchronously. 130 // the reference for protection asynchronously.
131 void dropProtection(Timer<WebSocket>*); 131 void dropProtection();
132 132
133 size_t getFramingOverhead(size_t payloadSize); 133 size_t getFramingOverhead(size_t payloadSize);
134 134
135 // Checks the result of WebSocketChannel::send() method, and shows console 135 // Checks the result of WebSocketChannel::send() method, and shows console
136 // message and sets ec appropriately. 136 // message and sets ec appropriately.
137 void handleSendResult(WebSocketChannel::SendResult, ExceptionState&); 137 void handleSendResult(WebSocketChannel::SendResult, ExceptionState&);
138 138
139 // Updates m_bufferedAmountAfterClose given the amount of data passed to 139 // Updates m_bufferedAmountAfterClose given the amount of data passed to
140 // send() method after the state changed to CLOSING or CLOSED. 140 // send() method after the state changed to CLOSING or CLOSED.
141 void updateBufferedAmountAfterClose(unsigned long); 141 void updateBufferedAmountAfterClose(unsigned long);
(...skipping 11 matching lines...) Expand all
153 unsigned long m_bufferedAmountAfterClose; 153 unsigned long m_bufferedAmountAfterClose;
154 BinaryType m_binaryType; 154 BinaryType m_binaryType;
155 String m_subprotocol; 155 String m_subprotocol;
156 String m_extensions; 156 String m_extensions;
157 157
158 // stop() needs to call some methods that may lead to invocation of handlers 158 // stop() needs to call some methods that may lead to invocation of handlers
159 // including a dispatchEvent() call. This flag is set at the beginning of 159 // including a dispatchEvent() call. This flag is set at the beginning of
160 // stop() to prevent dispatchEvent() from being called in such handlers. 160 // stop() to prevent dispatchEvent() from being called in such handlers.
161 bool m_stopped; 161 bool m_stopped;
162 162
163 Timer<WebSocket> m_timerForDeferredDropProtection; 163 AsyncMethodRunner<WebSocket> m_dropProtectionRunner;
164 }; 164 };
165 165
166 } // namespace WebCore 166 } // namespace WebCore
167 167
168 #endif // WebSocket_h 168 #endif // WebSocket_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698