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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2843353003: Move ownership of PowerSaveBlocker from WakeLockServiceContext to WakeLockServiceImpl (Closed)
Patch Set: code rebase Created 3 years, 7 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: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index a107c239d9bccbfe486bb319563a4fbc59daad21..6cee92c3e57c1e88a42edff7fcc9c039c79da5c0 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2622,12 +2622,26 @@ WebContentsImpl::GetGeolocationServiceContext() {
return geolocation_service_context_.get();
}
-device::mojom::WakeLockContext* WebContentsImpl::GetWakeLockServiceContext() {
+device::mojom::WakeLockContext* WebContentsImpl::GetWakeLockContext() {
if (!wake_lock_context_host_)
wake_lock_context_host_.reset(new WakeLockContextHost(this));
return wake_lock_context_host_->GetWakeLockContext();
}
+device::mojom::WakeLockService* WebContentsImpl::GetRendererWakeLock() {
+ // WebContents creates a long-lived connection to one WakeLockServiceImpl.
+ // All the frames' requests will be added into the BindingSet of
+ // WakeLockServiceImpl via this connection.
+ if (!renderer_wake_lock_) {
+ device::mojom::WakeLockContext* wake_lock_context = GetWakeLockContext();
+ if (!wake_lock_context) {
+ return nullptr;
+ }
+ wake_lock_context->GetWakeLock(mojo::MakeRequest(&renderer_wake_lock_));
+ }
+ return renderer_wake_lock_.get();
+}
+
void WebContentsImpl::OnShowValidationMessage(
RenderViewHostImpl* source,
const gfx::Rect& anchor_in_root_view,

Powered by Google App Engine
This is Rietveld 408576698