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 f98971ab43196f879bbe75a5494b461b3c8d2bfe..aeb777273f7b87876cc92ccfcdc7aeafcc94105d 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -2605,12 +2605,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) { |
blundell
2017/05/04 15:40:50
will this ever happen?
ke.he
2017/05/05 08:58:00
Yes, in https://cs.chromium.org/chromium/src/conte
|
+ 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, |