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/battery/BatteryManager.h" | 5 #include "modules/battery/BatteryManager.h" |
6 | 6 |
7 #include "core/dom/DOMException.h" | 7 #include "core/dom/DOMException.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/events/Event.h" | 9 #include "core/events/Event.h" |
10 #include "modules/battery/BatteryDispatcher.h" | 10 #include "modules/battery/BatteryDispatcher.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 m_hasEventListener = true; | 104 m_hasEventListener = true; |
105 startUpdating(); | 105 startUpdating(); |
106 } | 106 } |
107 | 107 |
108 void BatteryManager::contextDestroyed(ExecutionContext*) { | 108 void BatteryManager::contextDestroyed(ExecutionContext*) { |
109 m_hasEventListener = false; | 109 m_hasEventListener = false; |
110 m_batteryProperty = nullptr; | 110 m_batteryProperty = nullptr; |
111 stopUpdating(); | 111 stopUpdating(); |
112 } | 112 } |
113 | 113 |
114 void BatteryManager::contextDestroyed(Page*) {} | |
115 | |
116 bool BatteryManager::hasPendingActivity() const { | 114 bool BatteryManager::hasPendingActivity() const { |
117 // Prevent V8 from garbage collecting the wrapper object if there are | 115 // Prevent V8 from garbage collecting the wrapper object if there are |
118 // event listeners attached to it. | 116 // event listeners attached to it. |
119 return getExecutionContext() && hasEventListeners(); | 117 return getExecutionContext() && hasEventListeners(); |
120 } | 118 } |
121 | 119 |
122 DEFINE_TRACE(BatteryManager) { | 120 DEFINE_TRACE(BatteryManager) { |
123 visitor->trace(m_batteryProperty); | 121 visitor->trace(m_batteryProperty); |
124 PlatformEventController::trace(visitor); | 122 PlatformEventController::trace(visitor); |
125 EventTargetWithInlineData::trace(visitor); | 123 EventTargetWithInlineData::trace(visitor); |
126 SuspendableObject::trace(visitor); | 124 SuspendableObject::trace(visitor); |
127 } | 125 } |
128 | 126 |
129 } // namespace blink | 127 } // namespace blink |
OLD | NEW |