Fix memory mapping issue in AudioInputResource

With the new mojo browser-renderer audio input IPC code, shared memory
is shared read only with the renderer. This info is lost on the way to
pepper, causing it to try to map the memory with write permissons, even
though it's not needed.

When the memory enters closed-source code, it does so through
PPB_AudioInput_Callback_0_3 or PPB_AudioInput_Callback, so hopefully
noone will do something stupid like write to the memory there :).

Bug: 805901
Change-Id: I93517b1a7ba7583c4782c029c46cf3bead8d4875
Reviewed-on: https://chromium-review.googlesource.com/889158
Commit-Queue: Max Morin <[email protected]>
Reviewed-by: Antoine Labour <[email protected]>
Cr-Commit-Position: refs/heads/master@{#532275}
diff --git a/ppapi/proxy/audio_input_resource.cc b/ppapi/proxy/audio_input_resource.cc
index 0137440..59b78bfd 100644
--- a/ppapi/proxy/audio_input_resource.cc
+++ b/ppapi/proxy/audio_input_resource.cc
@@ -4,6 +4,8 @@
 
 #include "ppapi/proxy/audio_input_resource.h"
 
+#include <string>
+
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/numerics/safe_conversions.h"
@@ -182,7 +184,8 @@
     size_t shared_memory_size,
     base::SyncSocket::Handle socket_handle) {
   socket_.reset(new base::CancelableSyncSocket(socket_handle));
-  shared_memory_.reset(new base::SharedMemory(shared_memory_handle, false));
+  shared_memory_.reset(
+      new base::SharedMemory(shared_memory_handle, /*read_only*/ true));
   DCHECK(!shared_memory_->memory());
 
   // Ensure that the allocated memory is enough for the audio bus and buffer