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

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

Issue 2855373003: Check delegate before running Pepper media-device enumeration/monitoring requests. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2fd9a3b36d184db03fc2ff2a99c74408fab14305..dc4967c11216fcc587aac13517b450cbadd3f28c 100644
--- a/content/renderer/pepper/pepper_device_enumeration_host_helper.cc
+++ b/content/renderer/pepper/pepper_device_enumeration_host_helper.cc
@@ -35,6 +35,9 @@ class PepperDeviceEnumerationHostHelper::ScopedEnumerationRequest
if (!owner->document_url_.is_valid())
return;
+ if (!owner->delegate_)
yzshen1 2017/05/05 17:08:11 Sorry this has been too long ago. I don't remember
Guido Urdaneta 2017/05/05 17:18:12 It is also expected if the document_url is not val
yzshen1 2017/05/05 17:22:31 That makes sense. :)
+ return;
+
requested_ = true;
// Note that the callback passed into
@@ -44,7 +47,6 @@ class PepperDeviceEnumerationHostHelper::ScopedEnumerationRequest
// EnumerateDevicesCallbackBody() to ensure that we always call |callback|
// asynchronously.
sync_call_ = true;
- DCHECK(owner->delegate_);
owner->delegate_->EnumerateDevices(
owner->device_type_, owner->document_url_,
base::Bind(&ScopedEnumerationRequest::EnumerateDevicesCallbackBody,
@@ -91,9 +93,11 @@ class PepperDeviceEnumerationHostHelper::ScopedMonitoringRequest
if (!owner_->document_url_.is_valid())
return;
+ if (!owner->delegate_)
+ return;
+
requested_ = true;
- DCHECK(owner_->delegate_);
// |callback| is never called synchronously by StartMonitoringDevices(),
// so it is OK to pass it directly, even if |callback| destroys |this|.
subscription_id_ = owner_->delegate_->StartMonitoringDevices(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698