Chromium Code Reviews| OLD | NEW | 
|---|---|
| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 // resume() is called. | 58 // resume() is called. | 
| 59 void runAsync() | 59 void runAsync() | 
| 60 { | 60 { | 
| 61 if (m_suspended) { | 61 if (m_suspended) { | 
| 62 ASSERT(!m_timer.isActive()); | 62 ASSERT(!m_timer.isActive()); | 
| 63 m_runWhenResumed = true; | 63 m_runWhenResumed = true; | 
| 64 return; | 64 return; | 
| 65 } | 65 } | 
| 66 | 66 | 
| 67 if (!m_timer.isActive()) | 67 if (!m_timer.isActive()) | 
| 68 m_timer.startOneShot(0); | 68 m_timer.startOneShot(0, FROM_HERE); | 
| 
 
abarth-chromium
2014/03/09 22:19:10
This one isn't very useful  :)
 
 | |
| 69 } | 69 } | 
| 70 | 70 | 
| 71 // If it's scheduled to run the method, cancel it and remember to schedule | 71 // If it's scheduled to run the method, cancel it and remember to schedule | 
| 72 // it again when resume() is called. Mainly for implementing | 72 // it again when resume() is called. Mainly for implementing | 
| 73 // ActiveDOMObject::suspend(). | 73 // ActiveDOMObject::suspend(). | 
| 74 void suspend() | 74 void suspend() | 
| 75 { | 75 { | 
| 76 ASSERT(!m_suspended); | 76 ASSERT(!m_suspended); | 
| 77 m_suspended = true; | 77 m_suspended = true; | 
| 78 | 78 | 
| 79 if (!m_timer.isActive()) | 79 if (!m_timer.isActive()) | 
| 80 return; | 80 return; | 
| 81 | 81 | 
| 82 m_timer.stop(); | 82 m_timer.stop(); | 
| 83 m_runWhenResumed = true; | 83 m_runWhenResumed = true; | 
| 84 } | 84 } | 
| 85 | 85 | 
| 86 // Resumes pending method run. | 86 // Resumes pending method run. | 
| 87 void resume() | 87 void resume() | 
| 88 { | 88 { | 
| 89 ASSERT(m_suspended); | 89 ASSERT(m_suspended); | 
| 90 m_suspended = false; | 90 m_suspended = false; | 
| 91 | 91 | 
| 92 if (!m_runWhenResumed) | 92 if (!m_runWhenResumed) | 
| 93 return; | 93 return; | 
| 94 | 94 | 
| 95 m_runWhenResumed = false; | 95 m_runWhenResumed = false; | 
| 96 m_timer.startOneShot(0); | 96 m_timer.startOneShot(0, FROM_HERE); | 
| 97 } | 97 } | 
| 98 | 98 | 
| 99 void stop() | 99 void stop() | 
| 100 { | 100 { | 
| 101 if (m_suspended) { | 101 if (m_suspended) { | 
| 102 ASSERT(!m_timer.isActive()); | 102 ASSERT(!m_timer.isActive()); | 
| 103 m_runWhenResumed = false; | 103 m_runWhenResumed = false; | 
| 104 m_suspended = false; | 104 m_suspended = false; | 
| 105 return; | 105 return; | 
| 106 } | 106 } | 
| (...skipping 16 matching lines...) Expand all Loading... | |
| 123 TargetClass* m_object; | 123 TargetClass* m_object; | 
| 124 TargetMethod m_method; | 124 TargetMethod m_method; | 
| 125 | 125 | 
| 126 bool m_suspended; | 126 bool m_suspended; | 
| 127 bool m_runWhenResumed; | 127 bool m_runWhenResumed; | 
| 128 }; | 128 }; | 
| 129 | 129 | 
| 130 } | 130 } | 
| 131 | 131 | 
| 132 #endif | 132 #endif | 
| OLD | NEW |