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

Side by Side Diff: content/common/mac/app_nap_activity.h

Issue 2913883002: [Mac] Wrap NSUserActivity begin/end so that it can be called from common files (Closed)
Patch Set: Whitespace Created 3 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
« no previous file with comments | « content/common/BUILD.gn ('k') | content/common/mac/app_nap_activity.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_APP_NAP_ACTIVITY_H
6 #define CONTENT_COMMON_MAC_APP_NAP_ACTIVITY_H
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "content/common/content_export.h"
12
13 namespace content {
14
15 // Can't import scoped_nsobject here, so wrap it.
16 struct AssertionWrapper;
17
18 // A wrapper around the macOS "activity" system, which is required to
19 // make renderers eligible for AppNap.
20 //
21 // When doing work, processes are expected to begin an activity, receiving
22 // an opaque token called an "assertion". On finishing, they end the activity.
23 // When a process has no outstanding assertions, it becomes eligible for
24 // AppNap.
25 class CONTENT_EXPORT AppNapActivity {
26 public:
27 AppNapActivity();
28 ~AppNapActivity();
29
30 // Begin an activity and store the provided token.
31 void Begin();
32
33 // End the activity represented by |assertion_|.
34 void End();
35
36 private:
37 // An opaque token provided by the OS on beginning an activity.
38 std::unique_ptr<AssertionWrapper> assertion_;
39
40 DISALLOW_COPY_AND_ASSIGN(AppNapActivity);
41 };
42
43 } // namespace content
44
45 #endif // CONTENT_COMMON_MAC_APP_NAP_ACTIVITY_H
OLDNEW
« no previous file with comments | « content/common/BUILD.gn ('k') | content/common/mac/app_nap_activity.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698