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

Side by Side Diff: device/wake_lock/wake_lock_for_testing.cc

Issue 2921823002: Rationalize WakeLock naming conventions (Closed)
Patch Set: rebase 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 | « device/wake_lock/wake_lock_for_testing.h ('k') | device/wake_lock/wake_lock_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/wake_lock/wake_lock_service_impl_for_testing.h" 5 #include "device/wake_lock/wake_lock_for_testing.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 namespace device { 9 namespace device {
10 10
11 WakeLockServiceImplForTesting::WakeLockServiceImplForTesting( 11 WakeLockForTesting::WakeLockForTesting(
12 mojom::WakeLockServiceRequest request, 12 mojom::WakeLockRequest request,
13 mojom::WakeLockType type, 13 mojom::WakeLockType type,
14 mojom::WakeLockReason reason, 14 mojom::WakeLockReason reason,
15 const std::string& description, 15 const std::string& description,
16 int context_id, 16 int context_id,
17 WakeLockContextCallback native_view_getter, 17 WakeLockContextCallback native_view_getter,
18 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) 18 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner)
19 : WakeLockServiceImpl(std::move(request), 19 : WakeLock(std::move(request),
20 type, 20 type,
21 reason, 21 reason,
22 description, 22 description,
23 context_id, 23 context_id,
24 native_view_getter, 24 native_view_getter,
25 file_task_runner), 25 file_task_runner),
26 has_wake_lock_(false) {} 26 has_wake_lock_(false) {}
27 27
28 WakeLockServiceImplForTesting::~WakeLockServiceImplForTesting() {} 28 WakeLockForTesting::~WakeLockForTesting() {}
29 29
30 void WakeLockServiceImplForTesting::HasWakeLockForTests( 30 void WakeLockForTesting::HasWakeLockForTests(
31 HasWakeLockForTestsCallback callback) { 31 HasWakeLockForTestsCallback callback) {
32 std::move(callback).Run(has_wake_lock_); 32 std::move(callback).Run(has_wake_lock_);
33 } 33 }
34 34
35 void WakeLockServiceImplForTesting::UpdateWakeLock() { 35 void WakeLockForTesting::UpdateWakeLock() {
36 DCHECK(num_lock_requests_ >= 0); 36 DCHECK(num_lock_requests_ >= 0);
37 37
38 if (num_lock_requests_) { 38 if (num_lock_requests_) {
39 if (!has_wake_lock_) 39 if (!has_wake_lock_)
40 CreateWakeLock(); 40 CreateWakeLock();
41 } else { 41 } else {
42 if (has_wake_lock_) 42 if (has_wake_lock_)
43 RemoveWakeLock(); 43 RemoveWakeLock();
44 } 44 }
45 } 45 }
46 46
47 void WakeLockServiceImplForTesting::CreateWakeLock() { 47 void WakeLockForTesting::CreateWakeLock() {
48 DCHECK(!has_wake_lock_); 48 DCHECK(!has_wake_lock_);
49 has_wake_lock_ = true; 49 has_wake_lock_ = true;
50 } 50 }
51 51
52 void WakeLockServiceImplForTesting::RemoveWakeLock() { 52 void WakeLockForTesting::RemoveWakeLock() {
53 DCHECK(has_wake_lock_); 53 DCHECK(has_wake_lock_);
54 has_wake_lock_ = false; 54 has_wake_lock_ = false;
55 } 55 }
56 56
57 } // namespace device 57 } // namespace device
OLDNEW
« no previous file with comments | « device/wake_lock/wake_lock_for_testing.h ('k') | device/wake_lock/wake_lock_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698