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

Unified Diff: content/renderer/pepper/pepper_device_enumeration_host_helper.cc

Issue 653243003: Pepper: Access PepperMediaDeviceManager through a WeakPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/renderer/pepper/pepper_device_enumeration_host_helper.cc
diff --git a/content/renderer/pepper/pepper_device_enumeration_host_helper.cc b/content/renderer/pepper/pepper_device_enumeration_host_helper.cc
index d983f4a5816f70ae16d72aaa0959eb165a03503f..edc0840bb92a4c4307b7bc50bc717ae6b5813391 100644
--- a/content/renderer/pepper/pepper_device_enumeration_host_helper.cc
+++ b/content/renderer/pepper/pepper_device_enumeration_host_helper.cc
@@ -46,6 +46,7 @@ class PepperDeviceEnumerationHostHelper::ScopedRequest
// EnumerateDevicesCallbackBody() to ensure that we always call |callback|
// asynchronously.
sync_call_ = true;
+ DCHECK(owner_->delegate_);
request_id_ = owner_->delegate_->EnumerateDevices(
owner_->device_type_,
owner_->document_url_,
@@ -54,7 +55,7 @@ class PepperDeviceEnumerationHostHelper::ScopedRequest
}
~ScopedRequest() {
- if (requested_) {
+ if (requested_ && owner_->delegate_) {
owner_->delegate_->StopEnumerateDevices(request_id_);
}
}
@@ -91,7 +92,7 @@ class PepperDeviceEnumerationHostHelper::ScopedRequest
PepperDeviceEnumerationHostHelper::PepperDeviceEnumerationHostHelper(
ppapi::host::ResourceHost* resource_host,
- Delegate* delegate,
+ base::WeakPtr<Delegate> delegate,
PP_DeviceType_Dev device_type,
const GURL& document_url)
: resource_host_(resource_host),

Powered by Google App Engine
This is Rietveld 408576698