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

Side by Side Diff: third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.h

Issue 2138003002: Remove DOMWindowProperty::willDetachGlobalObjectFromFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temp Created 4 years, 5 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 /* 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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE 16 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
23 * DAMAGE. 23 * DAMAGE.
24 */ 24 */
25 25
26 #ifndef NavigatorGamepad_h 26 #ifndef NavigatorGamepad_h
27 #define NavigatorGamepad_h 27 #define NavigatorGamepad_h
28 28
29 #include "core/frame/DOMWindowProperty.h" 29 #include "core/dom/ContextLifecycleObserver.h"
30 #include "core/frame/LocalDOMWindow.h" 30 #include "core/frame/LocalDOMWindow.h"
31 #include "core/frame/PlatformEventController.h" 31 #include "core/frame/PlatformEventController.h"
32 #include "modules/ModulesExport.h" 32 #include "modules/ModulesExport.h"
33 #include "platform/AsyncMethodRunner.h" 33 #include "platform/AsyncMethodRunner.h"
34 #include "platform/Supplementable.h" 34 #include "platform/Supplementable.h"
35 #include "platform/heap/Handle.h" 35 #include "platform/heap/Handle.h"
36 #include "public/platform/WebGamepads.h" 36 #include "public/platform/WebGamepads.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 class Document; 40 class Document;
41 class Gamepad; 41 class Gamepad;
42 class GamepadList; 42 class GamepadList;
43 class Navigator; 43 class Navigator;
44 44
45 class MODULES_EXPORT NavigatorGamepad final : public GarbageCollectedFinalized<N avigatorGamepad>, public Supplement<Navigator>, public DOMWindowProperty, public PlatformEventController, public LocalDOMWindow::EventListenerObserver { 45 class MODULES_EXPORT NavigatorGamepad final : public GarbageCollectedFinalized<N avigatorGamepad>, public Supplement<Navigator>, public ContextLifecycleObserver, public PlatformEventController, public LocalDOMWindow::EventListenerObserver {
46 USING_GARBAGE_COLLECTED_MIXIN(NavigatorGamepad); 46 USING_GARBAGE_COLLECTED_MIXIN(NavigatorGamepad);
47 public: 47 public:
48 static NavigatorGamepad* from(Document&); 48 static NavigatorGamepad* from(Document&);
49 static NavigatorGamepad& from(Navigator&); 49 static NavigatorGamepad& from(Navigator&);
50 ~NavigatorGamepad() override; 50 ~NavigatorGamepad() override;
51 51
52 static GamepadList* getGamepads(Navigator&); 52 static GamepadList* getGamepads(Navigator&);
53 GamepadList* gamepads(); 53 GamepadList* gamepads();
54 54
55 DECLARE_VIRTUAL_TRACE(); 55 DECLARE_VIRTUAL_TRACE();
56 56
57 void didConnectOrDisconnectGamepad(unsigned index, const WebGamepad&, bool c onnected); 57 void didConnectOrDisconnectGamepad(unsigned index, const WebGamepad&, bool c onnected);
58 58
59 private: 59 private:
60 explicit NavigatorGamepad(LocalFrame*); 60 explicit NavigatorGamepad(LocalFrame*);
61 61
62 static const char* supplementName(); 62 static const char* supplementName();
63 63
64 void dispatchOneEvent(); 64 void dispatchOneEvent();
65 void didRemoveGamepadEventListeners(); 65 void didRemoveGamepadEventListeners();
66 bool startUpdatingIfAttached(); 66 bool startUpdatingIfAttached();
67 67
68 // DOMWindowProperty 68 // ContextLifecycleObserver
69 void willDestroyGlobalObjectInFrame() override; 69 void contextDestroyed() override;
70 void willDetachGlobalObjectFromFrame() override;
71 70
72 // PlatformEventController 71 // PlatformEventController
73 void registerWithDispatcher() override; 72 void registerWithDispatcher() override;
74 void unregisterWithDispatcher() override; 73 void unregisterWithDispatcher() override;
75 bool hasLastData() override; 74 bool hasLastData() override;
76 void didUpdateData() override; 75 void didUpdateData() override;
77 void pageVisibilityChanged() override; 76 void pageVisibilityChanged() override;
78 77
79 // LocalDOMWindow::EventListenerObserver 78 // LocalDOMWindow::EventListenerObserver
80 void didAddEventListener(LocalDOMWindow*, const AtomicString&) override; 79 void didAddEventListener(LocalDOMWindow*, const AtomicString&) override;
81 void didRemoveEventListener(LocalDOMWindow*, const AtomicString&) override; 80 void didRemoveEventListener(LocalDOMWindow*, const AtomicString&) override;
82 void didRemoveAllEventListeners(LocalDOMWindow*) override; 81 void didRemoveAllEventListeners(LocalDOMWindow*) override;
83 82
84 Member<GamepadList> m_gamepads; 83 Member<GamepadList> m_gamepads;
85 HeapDeque<Member<Gamepad>> m_pendingEvents; 84 HeapDeque<Member<Gamepad>> m_pendingEvents;
86 Member<AsyncMethodRunner<NavigatorGamepad>> m_dispatchOneEventRunner; 85 Member<AsyncMethodRunner<NavigatorGamepad>> m_dispatchOneEventRunner;
87 }; 86 };
88 87
89 } // namespace blink 88 } // namespace blink
90 89
91 #endif // NavigatorGamepad_h 90 #endif // NavigatorGamepad_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698