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

Unified Diff: device/wake_lock/wake_lock_service_context.h

Issue 2843353003: Move ownership of PowerSaveBlocker from WakeLockServiceContext to WakeLockServiceImpl (Closed)
Patch Set: error fix, non-frame client. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: device/wake_lock/wake_lock_service_context.h
diff --git a/device/wake_lock/wake_lock_service_context.h b/device/wake_lock/wake_lock_service_context.h
index 0baa1a79c394dfe79c5f460ba35fdf2da2533dbf..991b6e1301775e31605fe0600f6f3a0fa0afab1f 100644
--- a/device/wake_lock/wake_lock_service_context.h
+++ b/device/wake_lock/wake_lock_service_context.h
@@ -16,7 +16,6 @@
#include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h"
#include "device/wake_lock/wake_lock_service_impl.h"
#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/bindings/strong_binding_set.h"
#include "ui/gfx/native_widget_types.h"
@@ -49,38 +48,28 @@ class WakeLockServiceContext : public mojom::WakeLockContext {
~WakeLockServiceContext() override;
// mojom::WakeLockContext:
- void GetWakeLock(
- mojo::InterfaceRequest<mojom::WakeLockService> request) override;
+ void GetWakeLock(device::PowerSaveBlocker::PowerSaveBlockerType type,
+ device::PowerSaveBlocker::Reason reason,
+ const std::string& description,
+ mojom::WakeLockServiceRequest request) override;
void HasWakeLockForTests(
blundell 2017/05/02 11:27:43 IIUC, the only reason that this class still has an
ke.he 2017/05/04 11:54:14 Done.
const HasWakeLockForTestsCallback& callback) override;
-
- // Requests wake lock.
- void RequestWakeLock();
-
- // Cancels pending wake lock request.
- void CancelWakeLock();
+ void IncreaseWakeLockCount();
+ void DecreaseWakeLockCount();
private:
- void CreateWakeLock();
- void RemoveWakeLock();
- void UpdateWakeLock();
void OnContextBindingError();
// Checks whether this instance is still needed, and if not, destroys it.
void DestroyIfNoLongerNeeded();
- scoped_refptr<base::SequencedTaskRunner> main_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
- int num_lock_requests_;
-
- // The actual power save blocker for screen.
- std::unique_ptr<PowerSaveBlocker> wake_lock_;
+ // Counts number of wake lock instances, for test usage.
+ int wake_lock_count_;
-#if defined(OS_ANDROID)
int context_id_;
WakeLockContextCallback native_view_getter_;
-#endif
mojo::Binding<mojom::WakeLockContext> context_binding_;
bool context_binding_encountered_error_;

Powered by Google App Engine
This is Rietveld 408576698