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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 private: | 89 private: |
90 EventSource(ExecutionContext*, const KURL&, const Dictionary&); | 90 EventSource(ExecutionContext*, const KURL&, const Dictionary&); |
91 | 91 |
92 virtual void didReceiveResponse(unsigned long, const ResourceResponse&); | 92 virtual void didReceiveResponse(unsigned long, const ResourceResponse&); |
93 virtual void didReceiveData(const char*, int); | 93 virtual void didReceiveData(const char*, int); |
94 virtual void didFinishLoading(unsigned long, double); | 94 virtual void didFinishLoading(unsigned long, double); |
95 virtual void didFail(const ResourceError&); | 95 virtual void didFail(const ResourceError&); |
96 virtual void didFailAccessControlCheck(const ResourceError&); | 96 virtual void didFailAccessControlCheck(const ResourceError&); |
97 virtual void didFailRedirectCheck(); | 97 virtual void didFailRedirectCheck(); |
98 | 98 |
| 99 void scheduleInitialConnect(); |
99 void connect(); | 100 void connect(); |
100 void networkRequestEnded(); | 101 void networkRequestEnded(); |
101 void scheduleReconnect(); | 102 void scheduleReconnect(); |
102 void reconnectTimerFired(Timer<EventSource>*); | 103 void connectTimerFired(Timer<EventSource>*); |
103 void abortConnectionAttempt(); | 104 void abortConnectionAttempt(); |
104 void parseEventStream(); | 105 void parseEventStream(); |
105 void parseEventStreamLine(unsigned pos, int fieldLength, int lineLength); | 106 void parseEventStreamLine(unsigned pos, int fieldLength, int lineLength); |
106 PassRefPtr<MessageEvent> createMessageEvent(); | 107 PassRefPtr<MessageEvent> createMessageEvent(); |
107 | 108 |
108 KURL m_url; | 109 KURL m_url; |
109 bool m_withCredentials; | 110 bool m_withCredentials; |
110 State m_state; | 111 State m_state; |
111 | 112 |
112 RefPtr<TextResourceDecoder> m_decoder; | 113 RefPtr<TextResourceDecoder> m_decoder; |
113 RefPtr<ThreadableLoader> m_loader; | 114 RefPtr<ThreadableLoader> m_loader; |
114 Timer<EventSource> m_reconnectTimer; | 115 Timer<EventSource> m_connectTimer; |
115 Vector<UChar> m_receiveBuf; | 116 Vector<UChar> m_receiveBuf; |
116 bool m_discardTrailingNewline; | 117 bool m_discardTrailingNewline; |
117 bool m_requestInFlight; | 118 bool m_requestInFlight; |
118 | 119 |
119 String m_eventName; | 120 String m_eventName; |
120 Vector<UChar> m_data; | 121 Vector<UChar> m_data; |
121 String m_currentlyParsedEventId; | 122 String m_currentlyParsedEventId; |
122 String m_lastEventId; | 123 String m_lastEventId; |
123 unsigned long long m_reconnectDelay; | 124 unsigned long long m_reconnectDelay; |
124 String m_eventStreamOrigin; | 125 String m_eventStreamOrigin; |
125 }; | 126 }; |
126 | 127 |
127 } // namespace WebCore | 128 } // namespace WebCore |
128 | 129 |
129 #endif // EventSource_h | 130 #endif // EventSource_h |
OLD | NEW |