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, |