| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 class EventSourceInit; | 46 class EventSourceInit; |
| 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 CORE_EXPORT EventSource final : public RefCountedGarbageCollectedEventTarg
etWithInlineData<EventSource>, private ThreadableLoaderClient, public ActiveDOMO
bject { | 53 class CORE_EXPORT EventSource final : public RefCountedGarbageCollectedEventTarg
etWithInlineData<EventSource>, private ThreadableLoaderClient, public ActiveDOMO
bject { |
| 54 DEFINE_WRAPPERTYPEINFO(); | 54 DEFINE_WRAPPERTYPEINFO(); |
| 55 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(EventSource); | 55 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(EventSource); |
| 56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(EventSource); | 56 USING_GARBAGE_COLLECTED_MIXIN(EventSource); |
| 57 public: | 57 public: |
| 58 static EventSource* create(ExecutionContext*, const String& url, const Event
SourceInit&, ExceptionState&); | 58 static EventSource* create(ExecutionContext*, const String& url, const Event
SourceInit&, ExceptionState&); |
| 59 ~EventSource() override; | 59 ~EventSource() override; |
| 60 | 60 |
| 61 static const unsigned long long defaultReconnectDelay; | 61 static const unsigned long long defaultReconnectDelay; |
| 62 | 62 |
| 63 String url() const; | 63 String url() const; |
| 64 bool withCredentials() const; | 64 bool withCredentials() const; |
| 65 | 65 |
| 66 enum State : unsigned short { | 66 enum State : unsigned short { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 void didFailRedirectCheck() override; | 108 void didFailRedirectCheck() override; |
| 109 | 109 |
| 110 void scheduleInitialConnect(); | 110 void scheduleInitialConnect(); |
| 111 void connect(); | 111 void connect(); |
| 112 void networkRequestEnded(); | 112 void networkRequestEnded(); |
| 113 void scheduleReconnect(); | 113 void scheduleReconnect(); |
| 114 void connectTimerFired(Timer<EventSource>*); | 114 void connectTimerFired(Timer<EventSource>*); |
| 115 void abortConnectionAttempt(); | 115 void abortConnectionAttempt(); |
| 116 void parseEventStream(); | 116 void parseEventStream(); |
| 117 void parseEventStreamLine(unsigned pos, int fieldLength, int lineLength); | 117 void parseEventStreamLine(unsigned pos, int fieldLength, int lineLength); |
| 118 PassRefPtrWillBeRawPtr<MessageEvent> createMessageEvent(); | 118 RawPtr<MessageEvent> createMessageEvent(); |
| 119 | 119 |
| 120 KURL m_url; | 120 KURL m_url; |
| 121 bool m_withCredentials; | 121 bool m_withCredentials; |
| 122 State m_state; | 122 State m_state; |
| 123 | 123 |
| 124 OwnPtr<TextResourceDecoder> m_decoder; | 124 OwnPtr<TextResourceDecoder> m_decoder; |
| 125 RefPtr<ThreadableLoader> m_loader; | 125 RefPtr<ThreadableLoader> m_loader; |
| 126 Timer<EventSource> m_connectTimer; | 126 Timer<EventSource> m_connectTimer; |
| 127 Vector<UChar> m_receiveBuf; | 127 Vector<UChar> m_receiveBuf; |
| 128 bool m_discardTrailingNewline; | 128 bool m_discardTrailingNewline; |
| 129 bool m_requestInFlight; | 129 bool m_requestInFlight; |
| 130 | 130 |
| 131 AtomicString m_eventName; | 131 AtomicString m_eventName; |
| 132 Vector<UChar> m_data; | 132 Vector<UChar> m_data; |
| 133 AtomicString m_currentlyParsedEventId; | 133 AtomicString m_currentlyParsedEventId; |
| 134 AtomicString m_lastEventId; | 134 AtomicString m_lastEventId; |
| 135 unsigned long long m_reconnectDelay; | 135 unsigned long long m_reconnectDelay; |
| 136 String m_eventStreamOrigin; | 136 String m_eventStreamOrigin; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 } // namespace blink | 139 } // namespace blink |
| 140 | 140 |
| 141 #endif // EventSource_h | 141 #endif // EventSource_h |
| OLD | NEW |