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

Side by Side Diff: content/renderer/pepper/pepper_audio_input_host.cc

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Exclude certain files from jumbo because of a Windows problem Created 3 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/pepper/pepper_audio_input_host.h" 5 #include "content/renderer/pepper/pepper_audio_input_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/common/pepper_file_util.h" 9 #include "content/common/pepper_file_util.h"
10 #include "content/renderer/pepper/pepper_media_device_manager.h" 10 #include "content/renderer/pepper/pepper_media_device_manager.h"
11 #include "content/renderer/pepper/pepper_platform_audio_input.h" 11 #include "content/renderer/pepper/pepper_platform_audio_input.h"
12 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 12 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
13 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" 13 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
14 #include "content/renderer/render_frame_impl.h" 14 #include "content/renderer/render_frame_impl.h"
15 #include "ipc/ipc_message.h" 15 #include "ipc/ipc_message.h"
16 #include "ppapi/c/pp_errors.h" 16 #include "ppapi/c/pp_errors.h"
17 #include "ppapi/host/dispatch_host_message.h" 17 #include "ppapi/host/dispatch_host_message.h"
18 #include "ppapi/host/ppapi_host.h" 18 #include "ppapi/host/ppapi_host.h"
19 #include "ppapi/proxy/ppapi_messages.h" 19 #include "ppapi/proxy/ppapi_messages.h"
20 #include "ppapi/proxy/serialized_structs.h" 20 #include "ppapi/proxy/serialized_structs.h"
21 21
22 namespace content { 22 namespace content {
23 23
24 namespace {
25
26 base::PlatformFile ConvertSyncSocketHandle(const base::SyncSocket& socket) {
27 return socket.handle();
28 }
29
30 } // namespace
31
32 PepperAudioInputHost::PepperAudioInputHost(RendererPpapiHostImpl* host, 24 PepperAudioInputHost::PepperAudioInputHost(RendererPpapiHostImpl* host,
33 PP_Instance instance, 25 PP_Instance instance,
34 PP_Resource resource) 26 PP_Resource resource)
35 : ResourceHost(host->GetPpapiHost(), instance, resource), 27 : ResourceHost(host->GetPpapiHost(), instance, resource),
36 renderer_ppapi_host_(host), 28 renderer_ppapi_host_(host),
37 audio_input_(NULL), 29 audio_input_(NULL),
38 enumeration_helper_(this, 30 enumeration_helper_(this,
39 PepperMediaDeviceManager::GetForRenderFrame( 31 PepperMediaDeviceManager::GetForRenderFrame(
40 host->GetRenderFrameForInstance(pp_instance())), 32 host->GetRenderFrameForInstance(pp_instance())),
41 PP_DEVICETYPE_DEV_AUDIOCAPTURE, 33 PP_DEVICETYPE_DEV_AUDIOCAPTURE,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 open_context_.params.AppendHandle(serialized_shared_memory_handle); 150 open_context_.params.AppendHandle(serialized_shared_memory_handle);
159 SendOpenReply(result); 151 SendOpenReply(result);
160 } 152 }
161 153
162 int32_t PepperAudioInputHost::GetRemoteHandles( 154 int32_t PepperAudioInputHost::GetRemoteHandles(
163 const base::SyncSocket& socket, 155 const base::SyncSocket& socket,
164 const base::SharedMemory& shared_memory, 156 const base::SharedMemory& shared_memory,
165 IPC::PlatformFileForTransit* remote_socket_handle, 157 IPC::PlatformFileForTransit* remote_socket_handle,
166 base::SharedMemoryHandle* remote_shared_memory_handle) { 158 base::SharedMemoryHandle* remote_shared_memory_handle) {
167 *remote_socket_handle = renderer_ppapi_host_->ShareHandleWithRemote( 159 *remote_socket_handle = renderer_ppapi_host_->ShareHandleWithRemote(
168 ConvertSyncSocketHandle(socket), false); 160 socket.handle(), false);
169 if (*remote_socket_handle == IPC::InvalidPlatformFileForTransit()) 161 if (*remote_socket_handle == IPC::InvalidPlatformFileForTransit())
170 return PP_ERROR_FAILED; 162 return PP_ERROR_FAILED;
171 163
172 *remote_shared_memory_handle = 164 *remote_shared_memory_handle =
173 renderer_ppapi_host_->ShareSharedMemoryHandleWithRemote( 165 renderer_ppapi_host_->ShareSharedMemoryHandleWithRemote(
174 shared_memory.handle()); 166 shared_memory.handle());
175 if (!base::SharedMemory::IsHandleValid(*remote_shared_memory_handle)) 167 if (!base::SharedMemory::IsHandleValid(*remote_shared_memory_handle))
176 return PP_ERROR_FAILED; 168 return PP_ERROR_FAILED;
177 169
178 return PP_OK; 170 return PP_OK;
(...skipping 10 matching lines...) Expand all
189 SendOpenReply(PP_ERROR_ABORTED); 181 SendOpenReply(PP_ERROR_ABORTED);
190 } 182 }
191 183
192 void PepperAudioInputHost::SendOpenReply(int32_t result) { 184 void PepperAudioInputHost::SendOpenReply(int32_t result) {
193 open_context_.params.set_result(result); 185 open_context_.params.set_result(result);
194 host()->SendReply(open_context_, PpapiPluginMsg_AudioInput_OpenReply()); 186 host()->SendReply(open_context_, PpapiPluginMsg_AudioInput_OpenReply());
195 open_context_ = ppapi::host::ReplyMessageContext(); 187 open_context_ = ppapi::host::ReplyMessageContext();
196 } 188 }
197 189
198 } // namespace content 190 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698