| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EventSourceParser_h | 5 #ifndef EventSourceParser_h |
| 6 #define EventSourceParser_h | 6 #define EventSourceParser_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 #include "wtf/OwnPtr.h" | |
| 11 #include "wtf/Vector.h" | 10 #include "wtf/Vector.h" |
| 12 #include "wtf/text/AtomicString.h" | 11 #include "wtf/text/AtomicString.h" |
| 13 #include "wtf/text/TextCodec.h" | 12 #include "wtf/text/TextCodec.h" |
| 14 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
| 14 #include <memory> |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class CORE_EXPORT EventSourceParser final : public GarbageCollectedFinalized<Eve
ntSourceParser> { | 18 class CORE_EXPORT EventSourceParser final : public GarbageCollectedFinalized<Eve
ntSourceParser> { |
| 19 public: | 19 public: |
| 20 class CORE_EXPORT Client : public GarbageCollectedMixin { | 20 class CORE_EXPORT Client : public GarbageCollectedMixin { |
| 21 public: | 21 public: |
| 22 virtual ~Client() {} | 22 virtual ~Client() {} |
| 23 virtual void onMessageEvent(const AtomicString& type, const String& data
, const AtomicString& lastEventId) = 0; | 23 virtual void onMessageEvent(const AtomicString& type, const String& data
, const AtomicString& lastEventId) = 0; |
| 24 virtual void onReconnectionTimeSet(unsigned long long reconnectionTime)
= 0; | 24 virtual void onReconnectionTimeSet(unsigned long long reconnectionTime)
= 0; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 AtomicString m_eventType; | 42 AtomicString m_eventType; |
| 43 Vector<char> m_data; | 43 Vector<char> m_data; |
| 44 // This variable corresponds to "last event ID buffer" in the spec. The | 44 // This variable corresponds to "last event ID buffer" in the spec. The |
| 45 // value can be discarded when a connection is disconnected while | 45 // value can be discarded when a connection is disconnected while |
| 46 // parsing an event. | 46 // parsing an event. |
| 47 AtomicString m_id; | 47 AtomicString m_id; |
| 48 // This variable corresponds to "last event ID string" in the spec. | 48 // This variable corresponds to "last event ID string" in the spec. |
| 49 AtomicString m_lastEventId; | 49 AtomicString m_lastEventId; |
| 50 | 50 |
| 51 Member<Client> m_client; | 51 Member<Client> m_client; |
| 52 OwnPtr<TextCodec> m_codec; | 52 std::unique_ptr<TextCodec> m_codec; |
| 53 | 53 |
| 54 bool m_isRecognizingCRLF = false; | 54 bool m_isRecognizingCRLF = false; |
| 55 bool m_isRecognizingBOM = true; | 55 bool m_isRecognizingBOM = true; |
| 56 bool m_isStopped = false; | 56 bool m_isStopped = false; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace blink | 59 } // namespace blink |
| 60 | 60 |
| 61 #endif // EventSourceParser_h | 61 #endif // EventSourceParser_h |
| OLD | NEW |