| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 { | 75 { |
| 76 } | 76 } |
| 77 | 77 |
| 78 const char* NavigatorGamepad::supplementName() | 78 const char* NavigatorGamepad::supplementName() |
| 79 { | 79 { |
| 80 return "NavigatorGamepad"; | 80 return "NavigatorGamepad"; |
| 81 } | 81 } |
| 82 | 82 |
| 83 NavigatorGamepad& NavigatorGamepad::from(Navigator& navigator) | 83 NavigatorGamepad& NavigatorGamepad::from(Navigator& navigator) |
| 84 { | 84 { |
| 85 NavigatorGamepad* supplement = static_cast<NavigatorGamepad*>(Supplement<Nav
igator>::from(navigator, supplementName())); | 85 NavigatorGamepad* supplement = static_cast<NavigatorGamepad*>(WillBeHeapSupp
lement<Navigator>::from(navigator, supplementName())); |
| 86 if (!supplement) { | 86 if (!supplement) { |
| 87 supplement = new NavigatorGamepad(); | 87 supplement = new NavigatorGamepad(); |
| 88 provideTo(navigator, supplementName(), adoptPtr(supplement)); | 88 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); |
| 89 } | 89 } |
| 90 return *supplement; | 90 return *supplement; |
| 91 } | 91 } |
| 92 | 92 |
| 93 WebKitGamepadList* NavigatorGamepad::webkitGetGamepads(Navigator& navigator) | 93 WebKitGamepadList* NavigatorGamepad::webkitGetGamepads(Navigator& navigator) |
| 94 { | 94 { |
| 95 return NavigatorGamepad::from(navigator).webkitGamepads(); | 95 return NavigatorGamepad::from(navigator).webkitGamepads(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 GamepadList* NavigatorGamepad::getGamepads(Navigator& navigator) | 98 GamepadList* NavigatorGamepad::getGamepads(Navigator& navigator) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 GamepadList* NavigatorGamepad::gamepads() | 111 GamepadList* NavigatorGamepad::gamepads() |
| 112 { | 112 { |
| 113 if (!m_gamepads) | 113 if (!m_gamepads) |
| 114 m_gamepads = GamepadList::create(); | 114 m_gamepads = GamepadList::create(); |
| 115 sampleGamepads<Gamepad>(m_gamepads.get()); | 115 sampleGamepads<Gamepad>(m_gamepads.get()); |
| 116 return m_gamepads.get(); | 116 return m_gamepads.get(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void NavigatorGamepad::trace(Visitor* visitor) |
| 120 { |
| 121 visitor->trace(m_gamepads); |
| 122 visitor->trace(m_webkitGamepads); |
| 123 } |
| 124 |
| 119 } // namespace WebCore | 125 } // namespace WebCore |
| OLD | NEW |