| OLD | NEW |
| 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/dom/TaskRunnerHelper.h" | 8 #include "core/dom/TaskRunnerHelper.h" |
| 9 #include "core/events/Event.h" | 9 #include "core/events/Event.h" |
| 10 #include "modules/EventTargetModules.h" | 10 #include "modules/EventTargetModules.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 StopObserving(); | 109 StopObserving(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void NetworkInformation::RemoveAllEventListeners() { | 112 void NetworkInformation::RemoveAllEventListeners() { |
| 113 EventTargetWithInlineData::RemoveAllEventListeners(); | 113 EventTargetWithInlineData::RemoveAllEventListeners(); |
| 114 DCHECK(!HasEventListeners()); | 114 DCHECK(!HasEventListeners()); |
| 115 StopObserving(); | 115 StopObserving(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool NetworkInformation::HasPendingActivity() const { | 118 bool NetworkInformation::HasPendingActivity() const { |
| 119 ASSERT(context_stopped_ || observing_ == HasEventListeners()); | 119 DCHECK(context_stopped_ || observing_ == HasEventListeners()); |
| 120 | 120 |
| 121 // Prevent collection of this object when there are active listeners. | 121 // Prevent collection of this object when there are active listeners. |
| 122 return observing_; | 122 return observing_; |
| 123 } | 123 } |
| 124 | 124 |
| 125 void NetworkInformation::ContextDestroyed(ExecutionContext*) { | 125 void NetworkInformation::ContextDestroyed(ExecutionContext*) { |
| 126 context_stopped_ = true; | 126 context_stopped_ = true; |
| 127 StopObserving(); | 127 StopObserving(); |
| 128 } | 128 } |
| 129 | 129 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 152 downlink_max_mbps_(GetNetworkStateNotifier().MaxBandwidth()), | 152 downlink_max_mbps_(GetNetworkStateNotifier().MaxBandwidth()), |
| 153 observing_(false), | 153 observing_(false), |
| 154 context_stopped_(false) {} | 154 context_stopped_(false) {} |
| 155 | 155 |
| 156 DEFINE_TRACE(NetworkInformation) { | 156 DEFINE_TRACE(NetworkInformation) { |
| 157 EventTargetWithInlineData::Trace(visitor); | 157 EventTargetWithInlineData::Trace(visitor); |
| 158 ContextLifecycleObserver::Trace(visitor); | 158 ContextLifecycleObserver::Trace(visitor); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |