OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BASE_IOS_SCOPED_CRITICAL_ACTION_H_ | |
6 #define BASE_IOS_SCOPED_CRITICAL_ACTION_H_ | |
7 | |
8 #include "base/synchronization/lock.h" | |
9 | |
10 namespace base { | |
11 namespace ios { | |
12 | |
13 // This class allows the application to continue to run for a period of time | |
14 // after it transitions to the background. The construction of an instance of | |
15 // this class marks the beginning of a task that needs background running time | |
16 // when the application is moved to the background and the destruction marks the | |
17 // end of such a task. | |
18 // | |
19 // This class should be used at times where leaving a task unfinished might be | |
20 // detrimental to user experience. For example, it should be used to ensure that | |
21 // the application has enough time to save important data or at least attempt to | |
22 // save such data. | |
23 class ScopedCriticalAction { | |
24 public: | |
25 ScopedCriticalAction(); | |
26 ~ScopedCriticalAction(); | |
27 | |
28 private: | |
29 // Informs the OS that the background task has completed. | |
30 void EndBackgroundTask(); | |
31 | |
32 unsigned int background_task_id_; | |
Mark Mentovai
2012/07/31 23:16:33
What does this do? Comment it.
Chen Yu
2012/08/01 11:26:13
Done.
| |
33 Lock id_lock_; | |
Mark Mentovai
2012/07/31 23:16:33
What does this protect? Comment it. If it protects
Chen Yu
2012/08/01 11:26:13
Done.
| |
34 | |
35 DISALLOW_COPY_AND_ASSIGN(ScopedCriticalAction); | |
36 }; | |
37 | |
38 } // namespace ios | |
39 } // namespace base | |
40 | |
41 #endif // BASE_IOS_SCOPED_CRITICAL_ACTION_H_ | |
OLD | NEW |