Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/audio_helper.h" | 5 #include "content/renderer/pepper/audio_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/common/pepper_file_util.h" | 8 #include "content/common/pepper_file_util.h" |
| 9 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 | 21 |
| 22 int32_t AudioHelper::GetSyncSocketImpl(int* sync_socket) { | 22 int32_t AudioHelper::GetSyncSocketImpl(int* sync_socket) { |
| 23 if (socket_for_create_callback_) { | 23 if (socket_for_create_callback_) { |
| 24 *sync_socket = IntegerFromSyncSocketHandle( | 24 *sync_socket = IntegerFromSyncSocketHandle( |
| 25 socket_for_create_callback_->handle()); | 25 socket_for_create_callback_->handle()); |
| 26 return PP_OK; | 26 return PP_OK; |
| 27 } | 27 } |
| 28 return PP_ERROR_FAILED; | 28 return PP_ERROR_FAILED; |
| 29 } | 29 } |
| 30 | 30 |
| 31 int32_t AudioHelper::GetSharedMemoryImpl(int* shm_handle, uint32_t* shm_size) { | 31 int32_t AudioHelper::GetSharedMemoryImpl(base::SharedMemoryHandle* shm_handle, |
| 32 uint32_t* shm_size) { | |
| 32 if (shared_memory_for_create_callback_) { | 33 if (shared_memory_for_create_callback_) { |
| 33 *shm_handle = reinterpret_cast<int>(PlatformFileFromSharedMemoryHandle( | 34 *shm_handle = base::SharedMemory::ShallowCopyHandle( |
|
piman
2015/06/01 22:16:08
Do we need ShallowCopyHandle at all? Can we pass t
erikchen
2015/06/01 23:48:52
Good suggestion. Done.
We should also be able to
| |
| 34 shared_memory_for_create_callback_->handle())); | 35 shared_memory_for_create_callback_->handle()); |
| 35 *shm_size = shared_memory_size_for_create_callback_; | 36 *shm_size = shared_memory_size_for_create_callback_; |
| 36 return PP_OK; | 37 return PP_OK; |
| 37 } | 38 } |
| 38 return PP_ERROR_FAILED; | 39 return PP_ERROR_FAILED; |
| 39 } | 40 } |
| 40 | 41 |
| 41 void AudioHelper::StreamCreated(base::SharedMemoryHandle shared_memory_handle, | 42 void AudioHelper::StreamCreated(base::SharedMemoryHandle shared_memory_handle, |
| 42 size_t shared_memory_size, | 43 size_t shared_memory_size, |
| 43 base::SyncSocket::Handle socket_handle) { | 44 base::SyncSocket::Handle socket_handle) { |
| 44 if (TrackedCallback::IsPending(create_callback_)) { | 45 if (TrackedCallback::IsPending(create_callback_)) { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 64 } | 65 } |
| 65 } | 66 } |
| 66 | 67 |
| 67 void AudioHelper::SetCreateCallback( | 68 void AudioHelper::SetCreateCallback( |
| 68 scoped_refptr<ppapi::TrackedCallback> create_callback) { | 69 scoped_refptr<ppapi::TrackedCallback> create_callback) { |
| 69 DCHECK(!TrackedCallback::IsPending(create_callback_)); | 70 DCHECK(!TrackedCallback::IsPending(create_callback_)); |
| 70 create_callback_ = create_callback; | 71 create_callback_ = create_callback; |
| 71 } | 72 } |
| 72 | 73 |
| 73 } // namespace content | 74 } // namespace content |
| OLD | NEW |