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

Unified Diff: third_party/WebKit/Source/core/page/EventSource.h

Issue 1642563002: Introduce EventSourceParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@event-source-retry-fix
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/page/EventSource.h
diff --git a/third_party/WebKit/Source/core/page/EventSource.h b/third_party/WebKit/Source/core/page/EventSource.h
index 94651135958100f20ddb7efa2f44f869adeb5f2b..82a53d3a90e74ee88fe846cd4cc2d8be16b8bd6a 100644
--- a/third_party/WebKit/Source/core/page/EventSource.h
+++ b/third_party/WebKit/Source/core/page/EventSource.h
@@ -35,25 +35,23 @@
#include "core/dom/ActiveDOMObject.h"
#include "core/events/EventTarget.h"
#include "core/loader/ThreadableLoaderClient.h"
+#include "core/page/EventSourceParser.h"
#include "platform/Timer.h"
#include "platform/heap/Handle.h"
#include "platform/weborigin/KURL.h"
#include "wtf/RefPtr.h"
tyoshino (SeeGerritForStatus) 2016/01/28 07:31:43 add wtf/Forward.h for AtomicString
yhirano 2016/01/28 08:45:36 Done.
-#include "wtf/Vector.h"
namespace blink {
class EventSourceInit;
class ExceptionState;
-class MessageEvent;
class ResourceResponse;
-class TextResourceDecoder;
class ThreadableLoader;
-class CORE_EXPORT EventSource final : public RefCountedGarbageCollectedEventTargetWithInlineData<EventSource>, private ThreadableLoaderClient, public ActiveDOMObject {
+class CORE_EXPORT EventSource final : public RefCountedGarbageCollectedEventTargetWithInlineData<EventSource>, private ThreadableLoaderClient, public ActiveDOMObject, public EventSourceParser::Client {
DEFINE_WRAPPERTYPEINFO();
REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(EventSource);
- WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(EventSource);
+ USING_GARBAGE_COLLECTED_MIXIN(EventSource);
public:
static EventSource* create(ExecutionContext*, const String& url, const EventSourceInit&, ExceptionState&);
~EventSource() override;
@@ -92,11 +90,6 @@ public:
DECLARE_VIRTUAL_TRACE();
- void setStateForTest(State state) { m_state = state; }
- void setRequestInFlightForTest(bool b) { m_requestInFlight = b; }
- ThreadableLoaderClient* asThreadableLoaderClientForTest() { return this; }
- unsigned long long reconnectDelayForTest() const { return m_reconnectDelay; }
-
private:
EventSource(ExecutionContext*, const KURL&, const EventSourceInit&);
@@ -107,31 +100,24 @@ private:
void didFailAccessControlCheck(const ResourceError&) override;
void didFailRedirectCheck() override;
+ void onMessageEvent(const AtomicString& event, const String& data, const AtomicString& id) override;
+ void onReconnectionTimeSet(unsigned long long reconnectionTime) override;
+
void scheduleInitialConnect();
void connect();
void networkRequestEnded();
void scheduleReconnect();
void connectTimerFired(Timer<EventSource>*);
void abortConnectionAttempt();
- void parseEventStream();
- void parseEventStreamLine(unsigned pos, int fieldLength, int lineLength);
- PassRefPtrWillBeRawPtr<MessageEvent> createMessageEvent();
KURL m_url;
bool m_withCredentials;
State m_state;
- OwnPtr<TextResourceDecoder> m_decoder;
+ Member<EventSourceParser> m_parser;
RefPtr<ThreadableLoader> m_loader;
Timer<EventSource> m_connectTimer;
- Vector<UChar> m_receiveBuf;
- bool m_discardTrailingNewline;
bool m_requestInFlight;
-
- AtomicString m_eventName;
- Vector<UChar> m_data;
- AtomicString m_currentlyParsedEventId;
- AtomicString m_lastEventId;
unsigned long long m_reconnectDelay;
String m_eventStreamOrigin;
};

Powered by Google App Engine
This is Rietveld 408576698