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

Side by Side Diff: Source/core/frame/DeviceSensorEventController.cpp

Issue 306363002: Gamepad: honor page visibility (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: just a comment that it will be better with Oilpan Created 6 years, 6 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 2010 Apple Inc. All rights reserved. 2 * Copyright 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright 10 * * Redistributions in binary form must reproduce the above copyright
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 if (m_timer.isActive()) 95 if (m_timer.isActive())
96 m_timer.stop(); 96 m_timer.stop();
97 97
98 unregisterWithDispatcher(); 98 unregisterWithDispatcher();
99 m_isActive = false; 99 m_isActive = false;
100 } 100 }
101 101
102 void DeviceSensorEventController::pageVisibilityChanged() 102 void DeviceSensorEventController::pageVisibilityChanged()
103 { 103 {
104 if (!m_hasEventListener) 104 if (page()->visibilityState() == PageVisibilityStateVisible && m_hasEventLis tener)
105 return;
106
107 if (page()->visibilityState() == PageVisibilityStateVisible)
108 startUpdating(); 105 startUpdating();
109 else 106 else if (page()->visibilityState() == PageVisibilityStateHidden)
110 stopUpdating(); 107 stopUpdating();
111 } 108 }
112 109
113 } // namespace WebCore 110 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/DeviceSensorEventController.h ('k') | Source/modules/gamepad/NavigatorGamepad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698