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

Side by Side Diff: third_party/WebKit/Source/modules/netinfo/NetworkInformation.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 NetworkInformation_h 5 #ifndef NetworkInformation_h
6 #define NetworkInformation_h 6 #define NetworkInformation_h
7 7
8 #include "bindings/core/v8/ActiveScriptWrappable.h"
8 #include "core/dom/ActiveDOMObject.h" 9 #include "core/dom/ActiveDOMObject.h"
9 #include "core/events/EventTarget.h" 10 #include "core/events/EventTarget.h"
10 #include "core/page/NetworkStateNotifier.h" 11 #include "core/page/NetworkStateNotifier.h"
11 #include "public/platform/WebConnectionType.h" 12 #include "public/platform/WebConnectionType.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class ExecutionContext; 16 class ExecutionContext;
16 17
17 class NetworkInformation final 18 class NetworkInformation final
18 : public RefCountedGarbageCollectedEventTargetWithInlineData<NetworkInformat ion> 19 : public RefCountedGarbageCollectedEventTargetWithInlineData<NetworkInformat ion>
20 , public ActiveScriptWrappable
19 , public ActiveDOMObject 21 , public ActiveDOMObject
20 , public NetworkStateNotifier::NetworkStateObserver { 22 , public NetworkStateNotifier::NetworkStateObserver {
21 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(NetworkInformation); 23 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(NetworkInformation);
22 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NetworkInformation); 24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NetworkInformation);
23 DEFINE_WRAPPERTYPEINFO(); 25 DEFINE_WRAPPERTYPEINFO();
24 public: 26 public:
25 static NetworkInformation* create(ExecutionContext*); 27 static NetworkInformation* create(ExecutionContext*);
26 ~NetworkInformation() override; 28 ~NetworkInformation() override;
27 29
28 String type() const; 30 String type() const;
29 double downlinkMax() const; 31 double downlinkMax() const;
30 32
31 // NetworkStateObserver overrides. 33 // NetworkStateObserver overrides.
32 void connectionChange(WebConnectionType, double downlinkMaxMbps) override; 34 void connectionChange(WebConnectionType, double downlinkMaxMbps) override;
33 35
34 // EventTarget overrides. 36 // EventTarget overrides.
35 const AtomicString& interfaceName() const override; 37 const AtomicString& interfaceName() const override;
36 ExecutionContext* getExecutionContext() const override; 38 ExecutionContext* getExecutionContext() const override;
37 void removeAllEventListeners() override; 39 void removeAllEventListeners() override;
38 40
41 // ActiveScriptWrappable
42 bool hasPendingActivity() const final;
43
39 // ActiveDOMObject overrides. 44 // ActiveDOMObject overrides.
40 bool hasPendingActivity() const override;
41 void stop() override; 45 void stop() override;
42 46
43 DECLARE_VIRTUAL_TRACE(); 47 DECLARE_VIRTUAL_TRACE();
44 48
45 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); 49 DEFINE_ATTRIBUTE_EVENT_LISTENER(change);
46 DEFINE_ATTRIBUTE_EVENT_LISTENER(typechange); // Deprecated 50 DEFINE_ATTRIBUTE_EVENT_LISTENER(typechange); // Deprecated
47 51
48 protected: 52 protected:
49 // EventTarget overrides. 53 // EventTarget overrides.
50 bool addEventListenerInternal(const AtomicString& eventType, PassRefPtrWillB eRawPtr<EventListener>, const EventListenerOptions&) override; 54 bool addEventListenerInternal(const AtomicString& eventType, PassRefPtrWillB eRawPtr<EventListener>, const EventListenerOptions&) override;
(...skipping 13 matching lines...) Expand all
64 // Whether this object is listening for events from NetworkStateNotifier. 68 // Whether this object is listening for events from NetworkStateNotifier.
65 bool m_observing; 69 bool m_observing;
66 70
67 // Whether ActiveDOMObject::stop has been called. 71 // Whether ActiveDOMObject::stop has been called.
68 bool m_contextStopped; 72 bool m_contextStopped;
69 }; 73 };
70 74
71 } // namespace blink 75 } // namespace blink
72 76
73 #endif // NetworkInformation_h 77 #endif // NetworkInformation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698