OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 CONTENT_COMMON_MAC_ACTIVITY_H | |
6 #define CONTENT_COMMON_MAC_ACTIVITY_H | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "content/common/content_export.h" | |
12 | |
13 namespace mac { | |
Robert Sesek
2017/05/31 18:11:26
nit: blank lines surrounding the inside of the nam
Robert Sesek
2017/05/31 18:11:26
use |namespace content|
lgrey
2017/05/31 21:28:11
Done.
lgrey
2017/05/31 21:28:11
Done.
| |
14 // Can't import scoped_nsobject here, so wrap it. | |
15 class AssertionWrapper; | |
16 | |
17 // A wrapper around the macOS "activity" system, which is required to | |
18 // make renderers eligible for AppNap. | |
19 // | |
20 // When doing work, processes are expected to begin an activity, receiving | |
21 // an opaque token called an "assertion". On finishing, they end the activity. | |
22 // When a process has no outstanding assertions, it becomes eligible for | |
23 // AppNap. | |
24 class CONTENT_EXPORT Activity { | |
Robert Sesek
2017/05/31 18:11:26
"Activity" is a bit broad of a name. What about "A
lgrey
2017/05/31 21:28:12
Done.
| |
25 public: | |
26 Activity(); | |
27 // Begin an activity and store the provided token. | |
28 void Begin(); | |
Robert Sesek
2017/05/31 18:11:26
nit: blank line after
lgrey
2017/05/31 21:28:11
Done.
| |
29 // End the activity represented by |assertion_|. | |
30 void End(); | |
31 ~Activity(); | |
Robert Sesek
2017/05/31 18:11:26
Put this after the ctor.
lgrey
2017/05/31 21:28:12
Done.
| |
32 | |
33 private: | |
34 // An opaque token provided by the OS on beginning an activity. | |
35 std::unique_ptr<AssertionWrapper> assertion_; | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(Activity); | |
38 }; | |
39 } // namespace mac | |
40 | |
41 #endif // CONTENT_COMMON_MAC_ACTIVITY_H | |
OLD | NEW |