Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
| 6 * | 6 * |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 } | 121 } |
| 122 return m_gamepads.get(); | 122 return m_gamepads.get(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void NavigatorGamepad::trace(Visitor* visitor) | 125 void NavigatorGamepad::trace(Visitor* visitor) |
| 126 { | 126 { |
| 127 visitor->trace(m_gamepads); | 127 visitor->trace(m_gamepads); |
| 128 visitor->trace(m_webkitGamepads); | 128 visitor->trace(m_webkitGamepads); |
| 129 visitor->trace(m_pendingEvents); | 129 visitor->trace(m_pendingEvents); |
| 130 WillBeHeapSupplement<Navigator>::trace(visitor); | 130 WillBeHeapSupplement<Navigator>::trace(visitor); |
| 131 DOMWindowProperty::trace(visitor); | |
| 131 } | 132 } |
| 132 | 133 |
| 133 void NavigatorGamepad::didUpdateData() | 134 void NavigatorGamepad::didUpdateData() |
| 134 { | 135 { |
| 135 // We should stop listening once we detached. | 136 // We should stop listening once we detached. |
| 136 ASSERT(window()); | 137 ASSERT(window()); |
| 137 | 138 |
| 138 // We register to the dispatcher before sampling gamepads so we need to chec k if we actually have an event listener. | 139 // We register to the dispatcher before sampling gamepads so we need to chec k if we actually have an event listener. |
| 139 if (!m_hasEventListener) | 140 if (!m_hasEventListener) |
| 140 return; | 141 return; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 NavigatorGamepad::NavigatorGamepad(LocalFrame* frame) | 174 NavigatorGamepad::NavigatorGamepad(LocalFrame* frame) |
| 174 : DOMWindowProperty(frame) | 175 : DOMWindowProperty(frame) |
| 175 , PlatformEventController(frame ? frame->page() : 0) | 176 , PlatformEventController(frame ? frame->page() : 0) |
| 176 , DOMWindowLifecycleObserver(frame ? frame->domWindow() : 0) | 177 , DOMWindowLifecycleObserver(frame ? frame->domWindow() : 0) |
| 177 , m_dispatchOneEventRunner(this, &NavigatorGamepad::dispatchOneEvent) | 178 , m_dispatchOneEventRunner(this, &NavigatorGamepad::dispatchOneEvent) |
| 178 { | 179 { |
| 179 } | 180 } |
| 180 | 181 |
| 181 NavigatorGamepad::~NavigatorGamepad() | 182 NavigatorGamepad::~NavigatorGamepad() |
| 182 { | 183 { |
| 184 #if ENABLE(OILPAN) | |
| 185 stopUpdating(); | |
|
haraken
2014/09/10 02:49:36
Why is this necessary only in oilpan?
sof
2014/09/10 05:49:40
Can't rely on willDestroyGlobalObjectInFrame() hav
| |
| 186 #endif | |
| 183 } | 187 } |
| 184 | 188 |
| 185 const char* NavigatorGamepad::supplementName() | 189 const char* NavigatorGamepad::supplementName() |
| 186 { | 190 { |
| 187 return "NavigatorGamepad"; | 191 return "NavigatorGamepad"; |
| 188 } | 192 } |
| 189 | 193 |
| 190 void NavigatorGamepad::willDestroyGlobalObjectInFrame() | 194 void NavigatorGamepad::willDestroyGlobalObjectInFrame() |
| 191 { | 195 { |
| 192 stopUpdating(); | 196 stopUpdating(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { | 288 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { |
| 285 m_pendingEvents.append(newGamepad); | 289 m_pendingEvents.append(newGamepad); |
| 286 } | 290 } |
| 287 } | 291 } |
| 288 | 292 |
| 289 if (!m_pendingEvents.isEmpty()) | 293 if (!m_pendingEvents.isEmpty()) |
| 290 m_dispatchOneEventRunner.runAsync(); | 294 m_dispatchOneEventRunner.runAsync(); |
| 291 } | 295 } |
| 292 | 296 |
| 293 } // namespace blink | 297 } // namespace blink |
| OLD | NEW |