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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 class ResourceResponse; | 52 class ResourceResponse; |
53 | 53 |
54 class MODULES_EXPORT EventSource final | 54 class MODULES_EXPORT EventSource final |
55 : public EventTargetWithInlineData, | 55 : public EventTargetWithInlineData, |
56 private ThreadableLoaderClient, | 56 private ThreadableLoaderClient, |
57 public ActiveScriptWrappable<EventSource>, | 57 public ActiveScriptWrappable<EventSource>, |
58 public ContextLifecycleObserver, | 58 public ContextLifecycleObserver, |
59 public EventSourceParser::Client { | 59 public EventSourceParser::Client { |
60 DEFINE_WRAPPERTYPEINFO(); | 60 DEFINE_WRAPPERTYPEINFO(); |
61 USING_GARBAGE_COLLECTED_MIXIN(EventSource); | 61 USING_GARBAGE_COLLECTED_MIXIN(EventSource); |
| 62 USING_PRE_FINALIZER(EventSource, dispose); |
62 | 63 |
63 public: | 64 public: |
64 static EventSource* create(ExecutionContext*, | 65 static EventSource* create(ExecutionContext*, |
65 const String& url, | 66 const String& url, |
66 const EventSourceInit&, | 67 const EventSourceInit&, |
67 ExceptionState&); | 68 ExceptionState&); |
68 ~EventSource() override; | 69 ~EventSource() override; |
69 | 70 |
70 static const unsigned long long defaultReconnectDelay; | 71 static const unsigned long long defaultReconnectDelay; |
71 | 72 |
(...skipping 23 matching lines...) Expand all Loading... |
95 void contextDestroyed(ExecutionContext*) override; | 96 void contextDestroyed(ExecutionContext*) override; |
96 | 97 |
97 // ScriptWrappable | 98 // ScriptWrappable |
98 bool hasPendingActivity() const final; | 99 bool hasPendingActivity() const final; |
99 | 100 |
100 DECLARE_VIRTUAL_TRACE(); | 101 DECLARE_VIRTUAL_TRACE(); |
101 | 102 |
102 private: | 103 private: |
103 EventSource(ExecutionContext*, const KURL&, const EventSourceInit&); | 104 EventSource(ExecutionContext*, const KURL&, const EventSourceInit&); |
104 | 105 |
| 106 void dispose(); |
| 107 |
105 void didReceiveResponse(unsigned long, | 108 void didReceiveResponse(unsigned long, |
106 const ResourceResponse&, | 109 const ResourceResponse&, |
107 std::unique_ptr<WebDataConsumerHandle>) override; | 110 std::unique_ptr<WebDataConsumerHandle>) override; |
108 void didReceiveData(const char*, unsigned) override; | 111 void didReceiveData(const char*, unsigned) override; |
109 void didFinishLoading(unsigned long, double) override; | 112 void didFinishLoading(unsigned long, double) override; |
110 void didFail(const ResourceError&) override; | 113 void didFail(const ResourceError&) override; |
111 void didFailAccessControlCheck(const ResourceError&) override; | 114 void didFailAccessControlCheck(const ResourceError&) override; |
112 void didFailRedirectCheck() override; | 115 void didFailRedirectCheck() override; |
113 | 116 |
114 void onMessageEvent(const AtomicString& event, | 117 void onMessageEvent(const AtomicString& event, |
(...skipping 21 matching lines...) Expand all Loading... |
136 Member<ThreadableLoader> m_loader; | 139 Member<ThreadableLoader> m_loader; |
137 TaskRunnerTimer<EventSource> m_connectTimer; | 140 TaskRunnerTimer<EventSource> m_connectTimer; |
138 | 141 |
139 unsigned long long m_reconnectDelay; | 142 unsigned long long m_reconnectDelay; |
140 String m_eventStreamOrigin; | 143 String m_eventStreamOrigin; |
141 }; | 144 }; |
142 | 145 |
143 } // namespace blink | 146 } // namespace blink |
144 | 147 |
145 #endif // EventSource_h | 148 #endif // EventSource_h |
OLD | NEW |