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

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

Issue 1805843002: [v8 gc] Introduce a base class for all objects that can have pending activity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 4 years, 9 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 14 matching lines...) Expand all
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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 "bindings/core/v8/ActiveScriptWrappable.h"
35 #include "core/dom/ActiveDOMObject.h" 36 #include "core/dom/ActiveDOMObject.h"
36 #include "core/events/EventTarget.h" 37 #include "core/events/EventTarget.h"
37 #include "core/loader/ThreadableLoader.h" 38 #include "core/loader/ThreadableLoader.h"
38 #include "core/loader/ThreadableLoaderClient.h" 39 #include "core/loader/ThreadableLoaderClient.h"
39 #include "core/page/EventSourceParser.h" 40 #include "core/page/EventSourceParser.h"
40 #include "platform/Timer.h" 41 #include "platform/Timer.h"
41 #include "platform/heap/Handle.h" 42 #include "platform/heap/Handle.h"
42 #include "platform/weborigin/KURL.h" 43 #include "platform/weborigin/KURL.h"
43 #include "wtf/Forward.h" 44 #include "wtf/Forward.h"
44 #include "wtf/OwnPtr.h" 45 #include "wtf/OwnPtr.h"
45 46
46 namespace blink { 47 namespace blink {
47 48
48 class EventSourceInit; 49 class EventSourceInit;
49 class ExceptionState; 50 class ExceptionState;
50 class ResourceResponse; 51 class ResourceResponse;
51 52
52 class CORE_EXPORT EventSource final : public RefCountedGarbageCollectedEventTarg etWithInlineData<EventSource>, private ThreadableLoaderClient, public ActiveDOMO bject, public EventSourceParser::Client { 53 class CORE_EXPORT EventSource final : public RefCountedGarbageCollectedEventTarg etWithInlineData<EventSource>, private ThreadableLoaderClient, public ActiveScri ptWrappable, public ActiveDOMObject, public EventSourceParser::Client {
53 DEFINE_WRAPPERTYPEINFO(); 54 DEFINE_WRAPPERTYPEINFO();
54 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(EventSource); 55 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(EventSource);
55 USING_GARBAGE_COLLECTED_MIXIN(EventSource); 56 USING_GARBAGE_COLLECTED_MIXIN(EventSource);
56 public: 57 public:
57 static EventSource* create(ExecutionContext*, const String& url, const Event SourceInit&, ExceptionState&); 58 static EventSource* create(ExecutionContext*, const String& url, const Event SourceInit&, ExceptionState&);
58 ~EventSource() override; 59 ~EventSource() override;
59 60
60 static const unsigned long long defaultReconnectDelay; 61 static const unsigned long long defaultReconnectDelay;
61 62
62 String url() const; 63 String url() const;
(...skipping 17 matching lines...) Expand all
80 ExecutionContext* getExecutionContext() const override; 81 ExecutionContext* getExecutionContext() const override;
81 82
82 // ActiveDOMObject 83 // ActiveDOMObject
83 // 84 //
84 // Note: suspend() is noop since ScopedPageLoadDeferrer calls 85 // Note: suspend() is noop since ScopedPageLoadDeferrer calls
85 // Page::setDefersLoading() and it defers delivery of events from the 86 // Page::setDefersLoading() and it defers delivery of events from the
86 // loader, and therefore the methods of this class for receiving 87 // loader, and therefore the methods of this class for receiving
87 // asynchronous events from the loader won't be invoked. 88 // asynchronous events from the loader won't be invoked.
88 void stop() override; 89 void stop() override;
89 90
90 bool hasPendingActivity() const override; 91 // ActiveScriptWrappable
92 bool hasPendingActivity() const final;
91 93
92 DECLARE_VIRTUAL_TRACE(); 94 DECLARE_VIRTUAL_TRACE();
93 95
94 private: 96 private:
95 EventSource(ExecutionContext*, const KURL&, const EventSourceInit&); 97 EventSource(ExecutionContext*, const KURL&, const EventSourceInit&);
96 98
97 void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<W ebDataConsumerHandle>) override; 99 void didReceiveResponse(unsigned long, const ResourceResponse&, PassOwnPtr<W ebDataConsumerHandle>) override;
98 void didReceiveData(const char*, unsigned) override; 100 void didReceiveData(const char*, unsigned) override;
99 void didFinishLoading(unsigned long, double) override; 101 void didFinishLoading(unsigned long, double) override;
100 void didFail(const ResourceError&) override; 102 void didFail(const ResourceError&) override;
(...skipping 18 matching lines...) Expand all
119 OwnPtr<ThreadableLoader> m_loader; 121 OwnPtr<ThreadableLoader> m_loader;
120 Timer<EventSource> m_connectTimer; 122 Timer<EventSource> m_connectTimer;
121 123
122 unsigned long long m_reconnectDelay; 124 unsigned long long m_reconnectDelay;
123 String m_eventStreamOrigin; 125 String m_eventStreamOrigin;
124 }; 126 };
125 127
126 } // namespace blink 128 } // namespace blink
127 129
128 #endif // EventSource_h 130 #endif // EventSource_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698