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

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

Issue 216523002: Oilpan: Replace most of RefPtrs for Event objects with oilpan's transition types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // WebSocketChannelClient functions. 118 // WebSocketChannelClient functions.
119 virtual void didConnect() OVERRIDE; 119 virtual void didConnect() OVERRIDE;
120 virtual void didReceiveMessage(const String& message) OVERRIDE; 120 virtual void didReceiveMessage(const String& message) OVERRIDE;
121 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> >) OVERRIDE; 121 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> >) OVERRIDE;
122 virtual void didReceiveMessageError() OVERRIDE; 122 virtual void didReceiveMessageError() OVERRIDE;
123 virtual void didUpdateBufferedAmount(unsigned long bufferedAmount) OVERRIDE; 123 virtual void didUpdateBufferedAmount(unsigned long bufferedAmount) OVERRIDE;
124 virtual void didStartClosingHandshake() OVERRIDE; 124 virtual void didStartClosingHandshake() OVERRIDE;
125 virtual void didClose(unsigned long unhandledBufferedAmount, ClosingHandshak eCompletionStatus, unsigned short code, const String& reason) OVERRIDE; 125 virtual void didClose(unsigned long unhandledBufferedAmount, ClosingHandshak eCompletionStatus, unsigned short code, const String& reason) OVERRIDE;
126 126
127 private: 127 private:
128 // FIXME: This should inherit WebCore::EventQueue.
128 class EventQueue FINAL : public RefCounted<EventQueue> { 129 class EventQueue FINAL : public RefCounted<EventQueue> {
129 public: 130 public:
130 static PassRefPtr<EventQueue> create(EventTarget* target) { return adopt Ref(new EventQueue(target)); } 131 static PassRefPtr<EventQueue> create(EventTarget* target) { return adopt Ref(new EventQueue(target)); }
131 ~EventQueue(); 132 ~EventQueue();
132 133
133 // Dispatches the event if this queue is active. 134 // Dispatches the event if this queue is active.
134 // Queues the event if this queue is suspended. 135 // Queues the event if this queue is suspended.
135 // Does nothing otherwise. 136 // Does nothing otherwise.
136 void dispatch(PassRefPtr<Event> /* event */); 137 void dispatch(PassRefPtrWillBeRawPtr<Event> /* event */);
137 138
138 bool isEmpty() const; 139 bool isEmpty() const;
139 140
140 void suspend(); 141 void suspend();
141 void resume(); 142 void resume();
142 void stop(); 143 void stop();
143 144
144 private: 145 private:
145 enum State { 146 enum State {
146 Active, 147 Active,
147 Suspended, 148 Suspended,
148 Stopped, 149 Stopped,
149 }; 150 };
150 151
151 explicit EventQueue(EventTarget*); 152 explicit EventQueue(EventTarget*);
152 153
153 // Dispatches queued events if this queue is active. 154 // Dispatches queued events if this queue is active.
154 // Does nothing otherwise. 155 // Does nothing otherwise.
155 void dispatchQueuedEvents(); 156 void dispatchQueuedEvents();
156 void resumeTimerFired(Timer<EventQueue>*); 157 void resumeTimerFired(Timer<EventQueue>*);
157 158
158 State m_state; 159 State m_state;
159 EventTarget* m_target; 160 EventTarget* m_target;
160 Deque<RefPtr<Event> > m_events; 161 // FIXME: oilpan: This should be HeapDeque once it's implemented.
162 Deque<RefPtrWillBePersistent<Event> > m_events;
161 Timer<EventQueue> m_resumeTimer; 163 Timer<EventQueue> m_resumeTimer;
162 }; 164 };
163 165
164 explicit WebSocket(ExecutionContext*); 166 explicit WebSocket(ExecutionContext*);
165 167
166 // Adds a console message with JSMessageSource and ErrorMessageLevel. 168 // Adds a console message with JSMessageSource and ErrorMessageLevel.
167 void logError(const String& message); 169 void logError(const String& message);
168 170
169 // Handle the JavaScript close method call. close() methods on this class 171 // Handle the JavaScript close method call. close() methods on this class
170 // are just for determining if the optional code argument is supplied or 172 // are just for determining if the optional code argument is supplied or
(...skipping 26 matching lines...) Expand all
197 BinaryType m_binaryType; 199 BinaryType m_binaryType;
198 String m_subprotocol; 200 String m_subprotocol;
199 String m_extensions; 201 String m_extensions;
200 202
201 RefPtr<EventQueue> m_eventQueue; 203 RefPtr<EventQueue> m_eventQueue;
202 }; 204 };
203 205
204 } // namespace WebCore 206 } // namespace WebCore
205 207
206 #endif // WebSocket_h 208 #endif // WebSocket_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698