[M108 Aura Migration][NaCl][PPFwk] Add error logs + SVACE/DLOG/Static analysis fix
[platform/framework/web/chromium-efl.git] / content / renderer / pepper / pepper_audio_input_host.cc
index bae18a3..bf56b1f 100644 (file)
@@ -48,6 +48,7 @@ int32_t PepperAudioInputHost::OnResourceMessageReceived(
                                       OnStartOrStop)
     PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_AudioInput_Close, OnClose)
   PPAPI_END_MESSAGE_MAP()
+  LOG(ERROR) << "Resource message unresolved";
   return PP_ERROR_FAILED;
 }
 
@@ -66,14 +67,20 @@ int32_t PepperAudioInputHost::OnOpen(ppapi::host::HostMessageContext* context,
                                      const std::string& device_id,
                                      PP_AudioSampleRate sample_rate,
                                      uint32_t sample_frame_count) {
-  if (open_context_.is_valid())
+  if (open_context_.is_valid()) {
+    LOG(ERROR) << "Invalid open context";
     return PP_ERROR_INPROGRESS;
-  if (audio_input_)
+  }
+  if (audio_input_) {
+    LOG(ERROR) << "Audio input is not NULL";
     return PP_ERROR_FAILED;
+  }
 
   GURL document_url = renderer_ppapi_host_->GetDocumentURL(pp_instance());
-  if (!document_url.is_valid())
+  if (!document_url.is_valid()) {
+    LOG(ERROR) << "Invalid document URL";
     return PP_ERROR_FAILED;
+  }
 
   // When it is done, we'll get called back on StreamCreated() or
   // StreamCreationFailed().
@@ -88,6 +95,7 @@ int32_t PepperAudioInputHost::OnOpen(ppapi::host::HostMessageContext* context,
     open_context_ = context->MakeReplyMessageContext();
     return PP_OK_COMPLETIONPENDING;
   } else {
+    LOG(ERROR) << "Audio input is NULL";
     return PP_ERROR_FAILED;
   }
 }
@@ -95,8 +103,10 @@ int32_t PepperAudioInputHost::OnOpen(ppapi::host::HostMessageContext* context,
 int32_t PepperAudioInputHost::OnStartOrStop(
     ppapi::host::HostMessageContext* /* context */,
     bool capture) {
-  if (!audio_input_)
+  if (!audio_input_) {
+    LOG(ERROR) << "Audio input is NULL";
     return PP_ERROR_FAILED;
+  }
   if (capture)
     audio_input_->StartCapture();
   else
@@ -157,14 +167,18 @@ int32_t PepperAudioInputHost::GetRemoteHandles(
     base::ReadOnlySharedMemoryRegion* remote_shared_memory_region) {
   *remote_socket_handle =
       renderer_ppapi_host_->ShareHandleWithRemote(socket.handle(), false);
-  if (*remote_socket_handle == IPC::InvalidPlatformFileForTransit())
+  if (*remote_socket_handle == IPC::InvalidPlatformFileForTransit()) {
+    LOG(ERROR) << "Invalid platform file for transit";
     return PP_ERROR_FAILED;
+  }
 
   *remote_shared_memory_region =
       renderer_ppapi_host_->ShareReadOnlySharedMemoryRegionWithRemote(
           shared_memory_region);
-  if (!remote_shared_memory_region->IsValid())
+  if (!remote_shared_memory_region->IsValid()) {
+    LOG(ERROR) << "Invalid region for shared memory";
     return PP_ERROR_FAILED;
+  }
 
   return PP_OK;
 }