| 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 25 matching lines...) Expand all Loading... |
| 36 #include "core/events/EventTarget.h" | 36 #include "core/events/EventTarget.h" |
| 37 #include "core/loader/ThreadableLoaderClient.h" | 37 #include "core/loader/ThreadableLoaderClient.h" |
| 38 #include "platform/Timer.h" | 38 #include "platform/Timer.h" |
| 39 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
| 40 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 41 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
| 42 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 class Dictionary; | 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 EventSource FINAL : public RefCountedWillBeGarbageCollectedFinalized<Event
Source>, public EventTargetWithInlineData, private ThreadableLoaderClient, publi
c ActiveDOMObject { | 53 class EventSource FINAL : public RefCountedWillBeGarbageCollectedFinalized<Event
Source>, public EventTargetWithInlineData, private ThreadableLoaderClient, publi
c ActiveDOMObject { |
| 54 DEFINE_WRAPPERTYPEINFO(); | 54 DEFINE_WRAPPERTYPEINFO(); |
| 55 REFCOUNTED_EVENT_TARGET(EventSource); | 55 REFCOUNTED_EVENT_TARGET(EventSource); |
| 56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(EventSource); | 56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(EventSource); |
| 57 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 57 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
| 58 public: | 58 public: |
| 59 static PassRefPtrWillBeRawPtr<EventSource> create(ExecutionContext*, const S
tring& url, const Dictionary&, ExceptionState&); | 59 static PassRefPtrWillBeRawPtr<EventSource> create(ExecutionContext*, const S
tring& url, const EventSourceInit*, ExceptionState&); |
| 60 virtual ~EventSource(); | 60 virtual ~EventSource(); |
| 61 | 61 |
| 62 static const unsigned long long defaultReconnectDelay; | 62 static const unsigned long long defaultReconnectDelay; |
| 63 | 63 |
| 64 String url() const; | 64 String url() const; |
| 65 bool withCredentials() const; | 65 bool withCredentials() const; |
| 66 | 66 |
| 67 typedef short State; | 67 typedef short State; |
| 68 static const State CONNECTING = 0; | 68 static const State CONNECTING = 0; |
| 69 static const State OPEN = 1; | 69 static const State OPEN = 1; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 84 // | 84 // |
| 85 // Note: suspend() is noop since ScopedPageLoadDeferrer calls | 85 // Note: suspend() is noop since ScopedPageLoadDeferrer calls |
| 86 // Page::setDefersLoading() and it defers delivery of events from the | 86 // Page::setDefersLoading() and it defers delivery of events from the |
| 87 // loader, and therefore the methods of this class for receiving | 87 // loader, and therefore the methods of this class for receiving |
| 88 // asynchronous events from the loader won't be invoked. | 88 // asynchronous events from the loader won't be invoked. |
| 89 virtual void stop() OVERRIDE; | 89 virtual void stop() OVERRIDE; |
| 90 | 90 |
| 91 virtual bool hasPendingActivity() const OVERRIDE; | 91 virtual bool hasPendingActivity() const OVERRIDE; |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 EventSource(ExecutionContext*, const KURL&, const Dictionary&); | 94 EventSource(ExecutionContext*, const KURL&, const EventSourceInit*); |
| 95 | 95 |
| 96 virtual void didReceiveResponse(unsigned long, const ResourceResponse&) OVER
RIDE; | 96 virtual void didReceiveResponse(unsigned long, const ResourceResponse&) OVER
RIDE; |
| 97 virtual void didReceiveData(const char*, int) OVERRIDE; | 97 virtual void didReceiveData(const char*, int) OVERRIDE; |
| 98 virtual void didFinishLoading(unsigned long, double) OVERRIDE; | 98 virtual void didFinishLoading(unsigned long, double) OVERRIDE; |
| 99 virtual void didFail(const ResourceError&) OVERRIDE; | 99 virtual void didFail(const ResourceError&) OVERRIDE; |
| 100 virtual void didFailAccessControlCheck(const ResourceError&) OVERRIDE; | 100 virtual void didFailAccessControlCheck(const ResourceError&) OVERRIDE; |
| 101 virtual void didFailRedirectCheck() OVERRIDE; | 101 virtual void didFailRedirectCheck() OVERRIDE; |
| 102 | 102 |
| 103 void scheduleInitialConnect(); | 103 void scheduleInitialConnect(); |
| 104 void connect(); | 104 void connect(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 125 Vector<UChar> m_data; | 125 Vector<UChar> m_data; |
| 126 AtomicString m_currentlyParsedEventId; | 126 AtomicString m_currentlyParsedEventId; |
| 127 AtomicString m_lastEventId; | 127 AtomicString m_lastEventId; |
| 128 unsigned long long m_reconnectDelay; | 128 unsigned long long m_reconnectDelay; |
| 129 String m_eventStreamOrigin; | 129 String m_eventStreamOrigin; |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 } // namespace blink | 132 } // namespace blink |
| 133 | 133 |
| 134 #endif // EventSource_h | 134 #endif // EventSource_h |
| OLD | NEW |