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

Side by Side Diff: Source/platform/AsyncMethodRunner.h

Issue 346273008: Gamepad: make gamepad events play well with page visibility (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@gamepad-vis
Patch Set: oilpan and other fixes Created 6 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
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 10 * * Redistributions in binary form must reproduce the above
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // FIXME: runAsync should take a TraceLocation and pass it to timer here . 67 // FIXME: runAsync should take a TraceLocation and pass it to timer here .
68 if (!m_timer.isActive()) 68 if (!m_timer.isActive())
69 m_timer.startOneShot(0, FROM_HERE); 69 m_timer.startOneShot(0, FROM_HERE);
70 } 70 }
71 71
72 // If it's scheduled to run the method, cancel it and remember to schedule 72 // If it's scheduled to run the method, cancel it and remember to schedule
73 // it again when resume() is called. Mainly for implementing 73 // it again when resume() is called. Mainly for implementing
74 // ActiveDOMObject::suspend(). 74 // ActiveDOMObject::suspend().
75 void suspend() 75 void suspend()
76 { 76 {
77 ASSERT(!m_suspended); 77 if (m_suspended)
78 return;
kbalazs 2014/07/08 21:01:20 FYI I have added this to avoid special casing the
78 m_suspended = true; 79 m_suspended = true;
79 80
80 if (!m_timer.isActive()) 81 if (!m_timer.isActive())
81 return; 82 return;
82 83
83 m_timer.stop(); 84 m_timer.stop();
84 m_runWhenResumed = true; 85 m_runWhenResumed = true;
85 } 86 }
86 87
87 // Resumes pending method run. 88 // Resumes pending method run.
88 void resume() 89 void resume()
89 { 90 {
90 ASSERT(m_suspended); 91 if (!m_suspended)
92 return;
91 m_suspended = false; 93 m_suspended = false;
92 94
93 if (!m_runWhenResumed) 95 if (!m_runWhenResumed)
94 return; 96 return;
95 97
96 m_runWhenResumed = false; 98 m_runWhenResumed = false;
97 // FIXME: resume should take a TraceLocation and pass it to timer here. 99 // FIXME: resume should take a TraceLocation and pass it to timer here.
98 m_timer.startOneShot(0, FROM_HERE); 100 m_timer.startOneShot(0, FROM_HERE);
99 } 101 }
100 102
(...skipping 28 matching lines...) Expand all
129 TargetClass* m_object; 131 TargetClass* m_object;
130 TargetMethod m_method; 132 TargetMethod m_method;
131 133
132 bool m_suspended; 134 bool m_suspended;
133 bool m_runWhenResumed; 135 bool m_runWhenResumed;
134 }; 136 };
135 137
136 } 138 }
137 139
138 #endif 140 #endif
OLDNEW
« Source/modules/gamepad/NavigatorGamepad.h ('K') | « Source/modules/gamepad/NavigatorGamepad.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698