Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: third_party/WebKit/Source/core/page/EventSource.h

Issue 1264453002: Split the constructor of ThreadableLoader into two methods (ctor and start()) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed pipes around non-variables in a comment Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #ifndef EventSource_h 32 #ifndef EventSource_h
33 #define EventSource_h 33 #define EventSource_h
34 34
35 #include "core/dom/ActiveDOMObject.h" 35 #include "core/dom/ActiveDOMObject.h"
36 #include "core/events/EventTarget.h" 36 #include "core/events/EventTarget.h"
37 #include "core/loader/ThreadableLoader.h"
37 #include "core/loader/ThreadableLoaderClient.h" 38 #include "core/loader/ThreadableLoaderClient.h"
38 #include "platform/Timer.h" 39 #include "platform/Timer.h"
39 #include "platform/heap/Handle.h" 40 #include "platform/heap/Handle.h"
40 #include "platform/weborigin/KURL.h" 41 #include "platform/weborigin/KURL.h"
41 #include "wtf/RefPtr.h" 42 #include "wtf/RefPtr.h"
42 #include "wtf/Vector.h" 43 #include "wtf/Vector.h"
43 44
44 namespace blink { 45 namespace blink {
45 46
46 class EventSourceInit; 47 class EventSourceInit;
47 class ExceptionState; 48 class ExceptionState;
48 class MessageEvent; 49 class MessageEvent;
49 class ResourceResponse; 50 class ResourceResponse;
50 class TextResourceDecoder; 51 class TextResourceDecoder;
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 WILL_BE_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;
(...skipping 24 matching lines...) Expand all
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 void stop() override; 89 void stop() override;
90 90
91 bool hasPendingActivity() const override; 91 bool hasPendingActivity() const override;
92 92
93 DECLARE_VIRTUAL_TRACE(); 93 DECLARE_VIRTUAL_TRACE();
94 94
95 void setStateForTest(State state) { m_state = state; } 95 void setStateForTest(State state) { m_state = state; }
96 void setRequestInFlightForTest(bool b) { m_requestInFlight = b; } 96 void setThreadableLoaderForTest(PassRefPtr<ThreadableLoader> loader) { m_loa der = loader; }
97 ThreadableLoaderClient* asThreadableLoaderClientForTest() { return this; } 97 ThreadableLoaderClient* asThreadableLoaderClientForTest() { return this; }
98 unsigned long long reconnectDelayForTest() const { return m_reconnectDelay; } 98 unsigned long long reconnectDelayForTest() const { return m_reconnectDelay; }
99 99
100 private: 100 private:
101 EventSource(ExecutionContext*, const KURL&, const EventSourceInit&); 101 EventSource(ExecutionContext*, const KURL&, const EventSourceInit&);
102 102
103 void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<W ebDataConsumerHandle>) override; 103 void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<W ebDataConsumerHandle>) override;
104 void didReceiveData(const char*, unsigned) override; 104 void didReceiveData(const char*, unsigned) override;
105 void didFinishLoading(unsigned long, double) override; 105 void didFinishLoading(unsigned long, double) override;
106 void didFail(const ResourceError&) override; 106 void didFail(const ResourceError&) override;
(...skipping 12 matching lines...) Expand all
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;
130 129
131 AtomicString m_eventName; 130 AtomicString m_eventName;
132 Vector<UChar> m_data; 131 Vector<UChar> m_data;
133 AtomicString m_currentlyParsedEventId; 132 AtomicString m_currentlyParsedEventId;
134 AtomicString m_lastEventId; 133 AtomicString m_lastEventId;
135 unsigned long long m_reconnectDelay; 134 unsigned long long m_reconnectDelay;
136 String m_eventStreamOrigin; 135 String m_eventStreamOrigin;
137 }; 136 };
138 137
139 } // namespace blink 138 } // namespace blink
140 139
141 #endif // EventSource_h 140 #endif // EventSource_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp ('k') | third_party/WebKit/Source/core/page/EventSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698