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

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

Issue 8585013: Merge definitions of PlatformFileToInt and IntToPlatformFile to one place. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 int32_t Audio::GetSyncSocket(int* sync_socket) { 110 int32_t Audio::GetSyncSocket(int* sync_socket) {
111 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. 111 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface.
112 } 112 }
113 113
114 int32_t Audio::GetSharedMemory(int* shm_handle, uint32_t* shm_size) { 114 int32_t Audio::GetSharedMemory(int* shm_handle, uint32_t* shm_size) {
115 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. 115 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface.
116 } 116 }
117 117
118 namespace {
119
120 base::PlatformFile IntToPlatformFile(int32_t handle) {
121 // TODO(piman/brettw): Change trusted interface to return a PP_FileHandle,
122 // those casts are ugly.
123 #if defined(OS_WIN)
124 return reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle));
125 #elif defined(OS_POSIX)
126 return handle;
127 #else
128 #error Not implemented.
129 #endif
130 }
131
132 } // namespace
133
134 PPB_Audio_Proxy::PPB_Audio_Proxy(Dispatcher* dispatcher) 118 PPB_Audio_Proxy::PPB_Audio_Proxy(Dispatcher* dispatcher)
135 : InterfaceProxy(dispatcher), 119 : InterfaceProxy(dispatcher),
136 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 120 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
137 } 121 }
138 122
139 PPB_Audio_Proxy::~PPB_Audio_Proxy() { 123 PPB_Audio_Proxy::~PPB_Audio_Proxy() {
140 } 124 }
141 125
142 // static 126 // static
143 PP_Resource PPB_Audio_Proxy::CreateProxyResource( 127 PP_Resource PPB_Audio_Proxy::CreateProxyResource(
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( 304 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote(
321 IntToPlatformFile(shared_memory_handle), false); 305 IntToPlatformFile(shared_memory_handle), false);
322 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) 306 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit())
323 return PP_ERROR_FAILED; 307 return PP_ERROR_FAILED;
324 308
325 return PP_OK; 309 return PP_OK;
326 } 310 }
327 311
328 } // namespace proxy 312 } // namespace proxy
329 } // namespace ppapi 313 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698