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

Side by Side Diff: third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp

Issue 2629593004: Disambiguate LifecycleObserver::contextDestroyed (Closed)
Patch Set: temp Created 3 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 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 #include "modules/netinfo/NetworkInformation.h" 5 #include "modules/netinfo/NetworkInformation.h"
6 6
7 #include "core/dom/ExecutionContext.h" 7 #include "core/dom/ExecutionContext.h"
8 #include "core/events/Event.h" 8 #include "core/events/Event.h"
9 #include "core/page/NetworkStateNotifier.h" 9 #include "core/page/NetworkStateNotifier.h"
10 #include "modules/EventTargetModules.h" 10 #include "modules/EventTargetModules.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 stopObserving(); 116 stopObserving();
117 } 117 }
118 118
119 bool NetworkInformation::hasPendingActivity() const { 119 bool NetworkInformation::hasPendingActivity() const {
120 ASSERT(m_contextStopped || m_observing == hasEventListeners()); 120 ASSERT(m_contextStopped || m_observing == hasEventListeners());
121 121
122 // Prevent collection of this object when there are active listeners. 122 // Prevent collection of this object when there are active listeners.
123 return m_observing; 123 return m_observing;
124 } 124 }
125 125
126 void NetworkInformation::contextDestroyed() { 126 void NetworkInformation::contextDestroyed(ExecutionContext*) {
127 m_contextStopped = true; 127 m_contextStopped = true;
128 stopObserving(); 128 stopObserving();
129 } 129 }
130 130
131 void NetworkInformation::startObserving() { 131 void NetworkInformation::startObserving() {
132 if (!m_observing && !m_contextStopped) { 132 if (!m_observing && !m_contextStopped) {
133 m_type = networkStateNotifier().connectionType(); 133 m_type = networkStateNotifier().connectionType();
134 networkStateNotifier().addObserver(this, getExecutionContext()); 134 networkStateNotifier().addObserver(this, getExecutionContext());
135 m_observing = true; 135 m_observing = true;
136 } 136 }
(...skipping 12 matching lines...) Expand all
149 m_downlinkMaxMbps(networkStateNotifier().maxBandwidth()), 149 m_downlinkMaxMbps(networkStateNotifier().maxBandwidth()),
150 m_observing(false), 150 m_observing(false),
151 m_contextStopped(false) {} 151 m_contextStopped(false) {}
152 152
153 DEFINE_TRACE(NetworkInformation) { 153 DEFINE_TRACE(NetworkInformation) {
154 EventTargetWithInlineData::trace(visitor); 154 EventTargetWithInlineData::trace(visitor);
155 ContextLifecycleObserver::trace(visitor); 155 ContextLifecycleObserver::trace(visitor);
156 } 156 }
157 157
158 } // namespace blink 158 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/netinfo/NetworkInformation.h ('k') | third_party/WebKit/Source/modules/nfc/NFC.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698