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 28beb20936eca35601a28bf9018b655e21e0d87a..26ed02cedb30f63e65a2173c1f58822e0af550da 100644 |
--- a/content/renderer/pepper/pepper_device_enumeration_host_helper.cc |
+++ b/content/renderer/pepper/pepper_device_enumeration_host_helper.cc |
@@ -98,7 +98,8 @@ PepperDeviceEnumerationHostHelper::PepperDeviceEnumerationHostHelper( |
: resource_host_(resource_host), |
delegate_(delegate), |
device_type_(device_type), |
- document_url_(document_url) { |
+ document_url_(document_url), |
+ enumerate_devices_pending_(false) { |
} |
PepperDeviceEnumerationHostHelper::~PepperDeviceEnumerationHostHelper() { |
@@ -135,7 +136,7 @@ int32_t PepperDeviceEnumerationHostHelper::InternalHandleResourceMessage( |
int32_t PepperDeviceEnumerationHostHelper::OnEnumerateDevices( |
HostMessageContext* context) { |
- if (enumerate_devices_context_) |
+ if (enumerate_devices_pending_) |
return PP_ERROR_INPROGRESS; |
enumerate_.reset(new ScopedRequest( |
@@ -145,8 +146,8 @@ int32_t PepperDeviceEnumerationHostHelper::OnEnumerateDevices( |
if (!enumerate_->requested()) |
return PP_ERROR_FAILED; |
- enumerate_devices_context_.reset( |
- new ppapi::host::ReplyMessageContext(context->MakeReplyMessageContext())); |
+ enumerate_devices_pending_ = true; |
+ enumerate_devices_context_ = context->MakeReplyMessageContext(); |
return PP_OK_COMPLETIONPENDING; |
} |
@@ -170,15 +171,16 @@ int32_t PepperDeviceEnumerationHostHelper::OnStopMonitoringDeviceChange( |
void PepperDeviceEnumerationHostHelper::OnEnumerateDevicesComplete( |
int /* request_id */, |
const std::vector<ppapi::DeviceRefData>& devices) { |
- DCHECK(enumerate_devices_context_.get()); |
+ DCHECK(enumerate_devices_pending_); |
enumerate_.reset(NULL); |
- enumerate_devices_context_->params.set_result(PP_OK); |
+ enumerate_devices_context_.params.set_result(PP_OK); |
resource_host_->host()->SendReply( |
- *enumerate_devices_context_, |
+ enumerate_devices_context_, |
PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply(devices)); |
- enumerate_devices_context_.reset(); |
+ enumerate_devices_context_ = ppapi::host::ReplyMessageContext(); |
+ enumerate_devices_pending_ = false; |
} |
void PepperDeviceEnumerationHostHelper::OnNotifyDeviceChange( |