| 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 EventTargetWithInlineData, private ThreadableLoaderClient, public ActiveDOMOb
ject { | 53 class EventSource FINAL : public RefCounted<EventSource>, public ScriptWrappable
, public EventTargetWithInlineData, private ThreadableLoaderClient, public Activ
eDOMObject { |
| 54 WTF_MAKE_FAST_ALLOCATED; | 54 WTF_MAKE_FAST_ALLOCATED; |
| 55 REFCOUNTED_EVENT_TARGET(EventSource); | 55 REFCOUNTED_EVENT_TARGET(EventSource); |
| 56 public: | 56 public: |
| 57 static PassRefPtr<EventSource> create(ExecutionContext*, const String& url,
const Dictionary&, ExceptionState&); | 57 static PassRefPtr<EventSource> create(ExecutionContext*, const String& url,
const Dictionary&, ExceptionState&); |
| 58 virtual ~EventSource(); | 58 virtual ~EventSource(); |
| 59 | 59 |
| 60 static const unsigned long long defaultReconnectDelay; | 60 static const unsigned long long defaultReconnectDelay; |
| 61 | 61 |
| 62 String url() const; | 62 String url() const; |
| 63 bool withCredentials() const; | 63 bool withCredentials() const; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 82 // | 82 // |
| 83 // Note: suspend() is noop since PageGroupLoadDeferrer calls | 83 // Note: suspend() is noop since PageGroupLoadDeferrer calls |
| 84 // Page::setDefersLoading() and it defers delivery of events from the | 84 // Page::setDefersLoading() and it defers delivery of events from the |
| 85 // loader, and therefore the methods of this class for receiving | 85 // loader, and therefore the methods of this class for receiving |
| 86 // asynchronous events from the loader won't be invoked. | 86 // asynchronous events from the loader won't be invoked. |
| 87 virtual void stop() OVERRIDE; | 87 virtual void stop() OVERRIDE; |
| 88 | 88 |
| 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&) OVER
RIDE; |
| 93 virtual void didReceiveData(const char*, int); | 93 virtual void didReceiveData(const char*, int) OVERRIDE; |
| 94 virtual void didFinishLoading(unsigned long, double); | 94 virtual void didFinishLoading(unsigned long, double) OVERRIDE; |
| 95 virtual void didFail(const ResourceError&); | 95 virtual void didFail(const ResourceError&) OVERRIDE; |
| 96 virtual void didFailAccessControlCheck(const ResourceError&); | 96 virtual void didFailAccessControlCheck(const ResourceError&) OVERRIDE; |
| 97 virtual void didFailRedirectCheck(); | 97 virtual void didFailRedirectCheck() OVERRIDE; |
| 98 | 98 |
| 99 void scheduleInitialConnect(); | 99 void scheduleInitialConnect(); |
| 100 void connect(); | 100 void connect(); |
| 101 void networkRequestEnded(); | 101 void networkRequestEnded(); |
| 102 void scheduleReconnect(); | 102 void scheduleReconnect(); |
| 103 void connectTimerFired(Timer<EventSource>*); | 103 void connectTimerFired(Timer<EventSource>*); |
| 104 void abortConnectionAttempt(); | 104 void abortConnectionAttempt(); |
| 105 void parseEventStream(); | 105 void parseEventStream(); |
| 106 void parseEventStreamLine(unsigned pos, int fieldLength, int lineLength); | 106 void parseEventStreamLine(unsigned pos, int fieldLength, int lineLength); |
| 107 PassRefPtr<MessageEvent> createMessageEvent(); | 107 PassRefPtr<MessageEvent> createMessageEvent(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 121 Vector<UChar> m_data; | 121 Vector<UChar> m_data; |
| 122 AtomicString m_currentlyParsedEventId; | 122 AtomicString m_currentlyParsedEventId; |
| 123 AtomicString m_lastEventId; | 123 AtomicString m_lastEventId; |
| 124 unsigned long long m_reconnectDelay; | 124 unsigned long long m_reconnectDelay; |
| 125 String m_eventStreamOrigin; | 125 String m_eventStreamOrigin; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 } // namespace WebCore | 128 } // namespace WebCore |
| 129 | 129 |
| 130 #endif // EventSource_h | 130 #endif // EventSource_h |
| OLD | NEW |