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

Side by Side Diff: third_party/WebKit/Source/modules/vibration/VibrationController.cpp

Issue 2588663002: Remove unnecessary LifecycleObserver::clearContext (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/modules/geolocation/Geolocation.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Samsung Electronics 2 * Copyright (C) 2012 Samsung Electronics
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // |cancel| was in flight, so kick the timer to let |doVibrate| process the 170 // |cancel| was in flight, so kick the timer to let |doVibrate| process the
171 // pattern. 171 // pattern.
172 m_timerDoVibrate.startOneShot(0, BLINK_FROM_HERE); 172 m_timerDoVibrate.startOneShot(0, BLINK_FROM_HERE);
173 } 173 }
174 174
175 void VibrationController::contextDestroyed() { 175 void VibrationController::contextDestroyed() {
176 cancel(); 176 cancel();
177 177
178 // If the document context was destroyed, never call the mojo service again. 178 // If the document context was destroyed, never call the mojo service again.
179 m_service.reset(); 179 m_service.reset();
180
181 // The context is not automatically cleared, so do it manually.
182 ContextLifecycleObserver::clearContext();
183
184 // Page outlives ExecutionContext so stop observing it to avoid having
185 // |pageVisibilityChanged| or |contextDestroyed| called again.
186 PageVisibilityObserver::clearContext();
haraken 2016/12/19 06:13:13 Some objects inherit from both ContextLifecycleObs
187 } 180 }
188 181
189 void VibrationController::pageVisibilityChanged() { 182 void VibrationController::pageVisibilityChanged() {
190 if (!page()->isPageVisible()) 183 if (!page()->isPageVisible())
191 cancel(); 184 cancel();
192 } 185 }
193 186
194 DEFINE_TRACE(VibrationController) { 187 DEFINE_TRACE(VibrationController) {
195 ContextLifecycleObserver::trace(visitor); 188 ContextLifecycleObserver::trace(visitor);
196 PageVisibilityObserver::trace(visitor); 189 PageVisibilityObserver::trace(visitor);
197 } 190 }
198 191
199 } // namespace blink 192 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/geolocation/Geolocation.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698