OLD | NEW |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "wtf/OwnPtr.h" | 45 #include "wtf/OwnPtr.h" |
46 #include "wtf/RefCounted.h" | 46 #include "wtf/RefCounted.h" |
47 #include "wtf/text/AtomicStringHash.h" | 47 #include "wtf/text/AtomicStringHash.h" |
48 | 48 |
49 namespace WebCore { | 49 namespace WebCore { |
50 | 50 |
51 class Blob; | 51 class Blob; |
52 class ExceptionState; | 52 class ExceptionState; |
53 | 53 |
54 class WebSocket FINAL : public RefCountedWillBeRefCountedGarbageCollected<WebSoc
ket>, public ScriptWrappable, public EventTargetWithInlineData, public ActiveDOM
Object, public WebSocketChannelClient { | 54 class WebSocket FINAL : public RefCountedWillBeRefCountedGarbageCollected<WebSoc
ket>, public ScriptWrappable, public EventTargetWithInlineData, public ActiveDOM
Object, public WebSocketChannelClient { |
55 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<W
ebSocket>); | 55 REFCOUNTED_EVENT_TARGET(WebSocket); |
| 56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebSocket); |
56 public: | 57 public: |
57 static const char* subProtocolSeperator(); | 58 static const char* subProtocolSeperator(); |
58 // WebSocket instances must be used with a wrapper since this class's | 59 // WebSocket instances must be used with a wrapper since this class's |
59 // lifetime management is designed assuming the V8 holds a ref on it while | 60 // lifetime management is designed assuming the V8 holds a ref on it while |
60 // hasPendingActivity() returns true. | 61 // hasPendingActivity() returns true. |
61 static PassRefPtrWillBeRawPtr<WebSocket> create(ExecutionContext*, const Str
ing& url, ExceptionState&); | 62 static PassRefPtrWillBeRawPtr<WebSocket> create(ExecutionContext*, const Str
ing& url, ExceptionState&); |
62 static PassRefPtrWillBeRawPtr<WebSocket> create(ExecutionContext*, const Str
ing& url, const String& protocol, ExceptionState&); | 63 static PassRefPtrWillBeRawPtr<WebSocket> create(ExecutionContext*, const Str
ing& url, const String& protocol, ExceptionState&); |
63 static PassRefPtrWillBeRawPtr<WebSocket> create(ExecutionContext*, const Str
ing& url, const Vector<String>& protocols, ExceptionState&); | 64 static PassRefPtrWillBeRawPtr<WebSocket> create(ExecutionContext*, const Str
ing& url, const Vector<String>& protocols, ExceptionState&); |
64 virtual ~WebSocket(); | 65 virtual ~WebSocket(); |
65 | 66 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 117 |
117 // WebSocketChannelClient functions. | 118 // WebSocketChannelClient functions. |
118 virtual void didConnect() OVERRIDE; | 119 virtual void didConnect() OVERRIDE; |
119 virtual void didReceiveMessage(const String& message) OVERRIDE; | 120 virtual void didReceiveMessage(const String& message) OVERRIDE; |
120 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> >) OVERRIDE; | 121 virtual void didReceiveBinaryData(PassOwnPtr<Vector<char> >) OVERRIDE; |
121 virtual void didReceiveMessageError() OVERRIDE; | 122 virtual void didReceiveMessageError() OVERRIDE; |
122 virtual void didUpdateBufferedAmount(unsigned long bufferedAmount) OVERRIDE; | 123 virtual void didUpdateBufferedAmount(unsigned long bufferedAmount) OVERRIDE; |
123 virtual void didStartClosingHandshake() OVERRIDE; | 124 virtual void didStartClosingHandshake() OVERRIDE; |
124 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; |
125 | 126 |
126 void trace(Visitor*); | 127 virtual void trace(Visitor*) OVERRIDE; |
127 | 128 |
128 private: | 129 private: |
129 // FIXME: This should inherit WebCore::EventQueue. | 130 // FIXME: This should inherit WebCore::EventQueue. |
130 class EventQueue FINAL : public RefCountedWillBeGarbageCollectedFinalized<Ev
entQueue> { | 131 class EventQueue FINAL : public RefCountedWillBeGarbageCollectedFinalized<Ev
entQueue> { |
131 public: | 132 public: |
132 static PassRefPtrWillBeRawPtr<EventQueue> create(EventTarget* target) | 133 static PassRefPtrWillBeRawPtr<EventQueue> create(EventTarget* target) |
133 { | 134 { |
134 return adoptRefWillBeNoop(new EventQueue(target)); | 135 return adoptRefWillBeNoop(new EventQueue(target)); |
135 } | 136 } |
136 ~EventQueue(); | 137 ~EventQueue(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // The subprotocol the server selected. | 216 // The subprotocol the server selected. |
216 String m_subprotocol; | 217 String m_subprotocol; |
217 String m_extensions; | 218 String m_extensions; |
218 | 219 |
219 RefPtrWillBeMember<EventQueue> m_eventQueue; | 220 RefPtrWillBeMember<EventQueue> m_eventQueue; |
220 }; | 221 }; |
221 | 222 |
222 } // namespace WebCore | 223 } // namespace WebCore |
223 | 224 |
224 #endif // WebSocket_h | 225 #endif // WebSocket_h |
OLD | NEW |