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

Side by Side Diff: ppapi/proxy/ppb_audio_proxy.cc

Issue 1154613006: Update pepper to not assume that SharedMemoryHandle is an int. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove changes to base/memory. Created 5 years, 6 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 "ppapi/proxy/ppb_audio_proxy.h" 5 #include "ppapi/proxy/ppb_audio_proxy.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/threading/simple_thread.h" 8 #include "base/threading/simple_thread.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/ppb_audio.h" 10 #include "ppapi/c/ppb_audio.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Resource overrides. 43 // Resource overrides.
44 PPB_Audio_API* AsPPB_Audio_API() override; 44 PPB_Audio_API* AsPPB_Audio_API() override;
45 45
46 // PPB_Audio_API implementation. 46 // PPB_Audio_API implementation.
47 PP_Resource GetCurrentConfig() override; 47 PP_Resource GetCurrentConfig() override;
48 PP_Bool StartPlayback() override; 48 PP_Bool StartPlayback() override;
49 PP_Bool StopPlayback() override; 49 PP_Bool StopPlayback() override;
50 int32_t Open(PP_Resource config_id, 50 int32_t Open(PP_Resource config_id,
51 scoped_refptr<TrackedCallback> create_callback) override; 51 scoped_refptr<TrackedCallback> create_callback) override;
52 int32_t GetSyncSocket(int* sync_socket) override; 52 int32_t GetSyncSocket(int* sync_socket) override;
53 int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) override; 53 int32_t GetSharedMemory(base::SharedMemoryHandle* shm_handle,
54 uint32_t* shm_size) override;
54 55
55 private: 56 private:
56 // Owning reference to the current config object. This isn't actually used, 57 // Owning reference to the current config object. This isn't actually used,
57 // we just dish it out as requested by the plugin. 58 // we just dish it out as requested by the plugin.
58 PP_Resource config_; 59 PP_Resource config_;
59 60
60 DISALLOW_COPY_AND_ASSIGN(Audio); 61 DISALLOW_COPY_AND_ASSIGN(Audio);
61 }; 62 };
62 63
63 Audio::Audio(const HostResource& audio_id, 64 Audio::Audio(const HostResource& audio_id,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 116
116 int32_t Audio::Open(PP_Resource config_id, 117 int32_t Audio::Open(PP_Resource config_id,
117 scoped_refptr<TrackedCallback> create_callback) { 118 scoped_refptr<TrackedCallback> create_callback) {
118 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. 119 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface.
119 } 120 }
120 121
121 int32_t Audio::GetSyncSocket(int* sync_socket) { 122 int32_t Audio::GetSyncSocket(int* sync_socket) {
122 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. 123 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface.
123 } 124 }
124 125
125 int32_t Audio::GetSharedMemory(int* shm_handle, uint32_t* shm_size) { 126 int32_t Audio::GetSharedMemory(base::SharedMemoryHandle* shm_handle,
127 uint32_t* shm_size) {
126 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. 128 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface.
127 } 129 }
128 130
129 PPB_Audio_Proxy::PPB_Audio_Proxy(Dispatcher* dispatcher) 131 PPB_Audio_Proxy::PPB_Audio_Proxy(Dispatcher* dispatcher)
130 : InterfaceProxy(dispatcher), 132 : InterfaceProxy(dispatcher),
131 callback_factory_(this) { 133 callback_factory_(this) {
132 } 134 }
133 135
134 PPB_Audio_Proxy::~PPB_Audio_Proxy() { 136 PPB_Audio_Proxy::~PPB_Audio_Proxy() {
135 } 137 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 enter.object()->StartPlayback(); 241 enter.object()->StartPlayback();
240 else 242 else
241 enter.object()->StopPlayback(); 243 enter.object()->StopPlayback();
242 } 244 }
243 245
244 void PPB_Audio_Proxy::AudioChannelConnected( 246 void PPB_Audio_Proxy::AudioChannelConnected(
245 int32_t result, 247 int32_t result,
246 const HostResource& resource) { 248 const HostResource& resource) {
247 IPC::PlatformFileForTransit socket_handle = 249 IPC::PlatformFileForTransit socket_handle =
248 IPC::InvalidPlatformFileForTransit(); 250 IPC::InvalidPlatformFileForTransit();
249 base::SharedMemoryHandle shared_memory = IPC::InvalidPlatformFileForTransit(); 251 base::SharedMemoryHandle shared_memory = base::SharedMemory::NULLHandle();
250 uint32_t audio_buffer_length = 0; 252 uint32_t audio_buffer_length = 0;
251 253
252 int32_t result_code = result; 254 int32_t result_code = result;
253 if (result_code == PP_OK) { 255 if (result_code == PP_OK) {
254 result_code = GetAudioConnectedHandles(resource, &socket_handle, 256 result_code = GetAudioConnectedHandles(resource, &socket_handle,
255 &shared_memory, 257 &shared_memory,
256 &audio_buffer_length); 258 &audio_buffer_length);
257 } 259 }
258 260
259 // Send all the values, even on error. This simplifies some of our cleanup 261 // Send all the values, even on error. This simplifies some of our cleanup
(...skipping 23 matching lines...) Expand all
283 if (result != PP_OK) 285 if (result != PP_OK)
284 return result; 286 return result;
285 287
286 // socket_handle doesn't belong to us: don't close it. 288 // socket_handle doesn't belong to us: don't close it.
287 *foreign_socket_handle = dispatcher()->ShareHandleWithRemote( 289 *foreign_socket_handle = dispatcher()->ShareHandleWithRemote(
288 IntToPlatformFile(socket_handle), false); 290 IntToPlatformFile(socket_handle), false);
289 if (*foreign_socket_handle == IPC::InvalidPlatformFileForTransit()) 291 if (*foreign_socket_handle == IPC::InvalidPlatformFileForTransit())
290 return PP_ERROR_FAILED; 292 return PP_ERROR_FAILED;
291 293
292 // Get the shared memory for the buffer. 294 // Get the shared memory for the buffer.
293 int shared_memory_handle; 295 base::SharedMemoryHandle shared_memory_handle;
294 result = enter.object()->GetSharedMemory(&shared_memory_handle, 296 result = enter.object()->GetSharedMemory(&shared_memory_handle,
295 shared_memory_length); 297 shared_memory_length);
296 if (result != PP_OK) 298 if (result != PP_OK)
297 return result; 299 return result;
298 300
299 // shared_memory_handle doesn't belong to us: don't close it. 301 // shared_memory_handle doesn't belong to us: don't close it.
300 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( 302 *foreign_shared_memory_handle =
301 IntToPlatformFile(shared_memory_handle), false); 303 dispatcher()->ShareSharedMemoryHandleWithRemote(shared_memory_handle);
302 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) 304 if (!base::SharedMemory::IsHandleValid(*foreign_shared_memory_handle))
303 return PP_ERROR_FAILED; 305 return PP_ERROR_FAILED;
304 306
305 return PP_OK; 307 return PP_OK;
306 } 308 }
307 #endif // !defined(OS_NACL) 309 #endif // !defined(OS_NACL)
308 310
309 // Processed in the plugin (message from host). 311 // Processed in the plugin (message from host).
310 void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated( 312 void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated(
311 const HostResource& audio_id, 313 const HostResource& audio_id,
312 int32_t result_code, 314 int32_t result_code,
(...skipping 15 matching lines...) Expand all
328 static_cast<Audio*>(enter.object())->SetStreamInfo( 330 static_cast<Audio*>(enter.object())->SetStreamInfo(
329 enter.resource()->pp_instance(), handle.shmem(), handle.size(), 331 enter.resource()->pp_instance(), handle.shmem(), handle.size(),
330 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), 332 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()),
331 config.object()->GetSampleRate(), 333 config.object()->GetSampleRate(),
332 config.object()->GetSampleFrameCount()); 334 config.object()->GetSampleFrameCount());
333 } 335 }
334 } 336 }
335 337
336 } // namespace proxy 338 } // namespace proxy
337 } // namespace ppapi 339 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698