OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved. |
3 * Copyright (C) 2010 Apple Inc. All rights reserved. | 3 * Copyright (C) 2010 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 namespace WebCore { | 44 namespace WebCore { |
45 | 45 |
46 class Dictionary; | 46 class Dictionary; |
47 class ExceptionState; | 47 class ExceptionState; |
48 class MessageEvent; | 48 class MessageEvent; |
49 class ResourceResponse; | 49 class ResourceResponse; |
50 class TextResourceDecoder; | 50 class TextResourceDecoder; |
51 class ThreadableLoader; | 51 class ThreadableLoader; |
52 | 52 |
53 class EventSource : public RefCounted<EventSource>, public ScriptWrappable, publ
ic EventTarget, private ThreadableLoaderClient, public ActiveDOMObject { | 53 class EventSource : public RefCounted<EventSource>, public ScriptWrappable, publ
ic EventTargetWithInlineData, private ThreadableLoaderClient, public ActiveDOMOb
ject { |
54 WTF_MAKE_FAST_ALLOCATED; | 54 WTF_MAKE_FAST_ALLOCATED; |
55 public: | 55 public: |
56 static PassRefPtr<EventSource> create(ScriptExecutionContext*, const String&
url, const Dictionary&, ExceptionState&); | 56 static PassRefPtr<EventSource> create(ScriptExecutionContext*, const String&
url, const Dictionary&, ExceptionState&); |
57 virtual ~EventSource(); | 57 virtual ~EventSource(); |
58 | 58 |
59 static const unsigned long long defaultReconnectDelay; | 59 static const unsigned long long defaultReconnectDelay; |
60 | 60 |
61 String url() const; | 61 String url() const; |
62 bool withCredentials() const; | 62 bool withCredentials() const; |
63 | 63 |
64 typedef short State; | 64 typedef short State; |
65 static const State CONNECTING = 0; | 65 static const State CONNECTING = 0; |
66 static const State OPEN = 1; | 66 static const State OPEN = 1; |
67 static const State CLOSED = 2; | 67 static const State CLOSED = 2; |
68 | 68 |
69 State readyState() const; | 69 State readyState() const; |
70 | 70 |
71 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); | 71 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); |
72 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 72 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
73 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
74 | 74 |
75 void close(); | 75 void close(); |
76 | 76 |
77 using RefCounted<EventSource>::ref; | 77 using RefCounted<EventSource>::ref; |
78 using RefCounted<EventSource>::deref; | 78 using RefCounted<EventSource>::deref; |
79 | 79 |
80 virtual const AtomicString& interfaceName() const; | 80 virtual const AtomicString& interfaceName() const OVERRIDE; |
81 virtual ScriptExecutionContext* scriptExecutionContext() const; | 81 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; |
82 | 82 |
83 virtual void stop(); | 83 virtual void stop(); |
84 | 84 |
85 private: | 85 private: |
86 EventSource(ScriptExecutionContext*, const KURL&, const Dictionary&); | 86 EventSource(ScriptExecutionContext*, const KURL&, const Dictionary&); |
87 | 87 |
88 virtual void refEventTarget() { ref(); } | 88 virtual void refEventTarget() OVERRIDE { ref(); } |
89 virtual void derefEventTarget() { deref(); } | 89 virtual void derefEventTarget() OVERRIDE { deref(); } |
90 virtual EventTargetData* eventTargetData(); | |
91 virtual EventTargetData* ensureEventTargetData(); | |
92 | 90 |
93 virtual void didReceiveResponse(unsigned long, const ResourceResponse&); | 91 virtual void didReceiveResponse(unsigned long, const ResourceResponse&); |
94 virtual void didReceiveData(const char*, int); | 92 virtual void didReceiveData(const char*, int); |
95 virtual void didFinishLoading(unsigned long, double); | 93 virtual void didFinishLoading(unsigned long, double); |
96 virtual void didFail(const ResourceError&); | 94 virtual void didFail(const ResourceError&); |
97 virtual void didFailAccessControlCheck(const ResourceError&); | 95 virtual void didFailAccessControlCheck(const ResourceError&); |
98 virtual void didFailRedirectCheck(); | 96 virtual void didFailRedirectCheck(); |
99 | 97 |
100 void connect(); | 98 void connect(); |
101 void networkRequestEnded(); | 99 void networkRequestEnded(); |
(...skipping 14 matching lines...) Expand all Loading... |
116 Vector<UChar> m_receiveBuf; | 114 Vector<UChar> m_receiveBuf; |
117 bool m_discardTrailingNewline; | 115 bool m_discardTrailingNewline; |
118 bool m_requestInFlight; | 116 bool m_requestInFlight; |
119 | 117 |
120 String m_eventName; | 118 String m_eventName; |
121 Vector<UChar> m_data; | 119 Vector<UChar> m_data; |
122 String m_currentlyParsedEventId; | 120 String m_currentlyParsedEventId; |
123 String m_lastEventId; | 121 String m_lastEventId; |
124 unsigned long long m_reconnectDelay; | 122 unsigned long long m_reconnectDelay; |
125 String m_eventStreamOrigin; | 123 String m_eventStreamOrigin; |
126 | |
127 EventTargetData m_eventTargetData; | |
128 }; | 124 }; |
129 | 125 |
130 } // namespace WebCore | 126 } // namespace WebCore |
131 | 127 |
132 #endif // EventSource_h | 128 #endif // EventSource_h |
OLD | NEW |