Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef PPAPI_PROXY_PROXY_CHANNEL_H_ | 5 #ifndef PPAPI_PROXY_PROXY_CHANNEL_H_ |
| 6 #define PPAPI_PROXY_PROXY_CHANNEL_H_ | 6 #define PPAPI_PROXY_PROXY_CHANNEL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/process.h" | 9 #include "base/process.h" |
| 10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
| 11 #include "ipc/ipc_platform_file.h" | 11 #include "ipc/ipc_platform_file.h" |
| 12 #include "ipc/ipc_sync_channel.h" | 12 #include "ipc/ipc_sync_channel.h" |
| 13 #include "ppapi/proxy/ppapi_proxy_export.h" | 13 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class MessageLoopProxy; | 16 class MessageLoopProxy; |
| 17 class WaitableEvent; | 17 class WaitableEvent; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace IPC { | 20 namespace IPC { |
| 21 class TestSink; | 21 class TestSink; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace ppapi { | 24 namespace ppapi { |
| 25 namespace proxy { | 25 namespace proxy { |
| 26 | 26 |
| 27 // TODO(piman/brettw): Change trusted interface to return a PP_FileHandle, | |
| 28 // those casts are ugly. | |
| 29 inline base::PlatformFile IntToPlatformFile(int32_t handle) { | |
| 30 #if defined(OS_WIN) | |
| 31 return reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle)); | |
| 32 #elif defined(OS_POSIX) | |
| 33 return handle; | |
| 34 #else | |
| 35 #error Not implemented. | |
| 36 #endif | |
| 37 } | |
| 38 | |
| 39 inline int32_t PlatformFileToInt(base::PlatformFile handle) { | |
| 40 #if defined(OS_WIN) | |
| 41 return static_cast<int32_t>(reinterpret_cast<intptr_t>(handle)); | |
| 42 #elif defined(OS_POSIX) | |
| 43 return handle; | |
| 44 #else | |
| 45 #error Not implemented. | |
| 46 #endif | |
| 47 } | |
|
piman
2011/11/22 20:20:36
I'm not sure these functions belong to this file..
xhwang
2011/11/22 23:22:58
As discussed offline, these functions will stay in
| |
| 48 | |
| 27 class PPAPI_PROXY_EXPORT ProxyChannel | 49 class PPAPI_PROXY_EXPORT ProxyChannel |
| 28 : public IPC::Channel::Listener, | 50 : public IPC::Channel::Listener, |
| 29 public IPC::Message::Sender { | 51 public IPC::Message::Sender { |
| 30 public: | 52 public: |
| 31 typedef void (*ShutdownModuleFunc)(); | 53 typedef void (*ShutdownModuleFunc)(); |
| 32 | 54 |
| 33 class PPAPI_PROXY_EXPORT Delegate { | 55 class PPAPI_PROXY_EXPORT Delegate { |
| 34 public: | 56 public: |
| 35 virtual ~Delegate() {} | 57 virtual ~Delegate() {} |
| 36 | 58 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 // remote side has crashed. | 125 // remote side has crashed. |
| 104 scoped_ptr<IPC::SyncChannel> channel_; | 126 scoped_ptr<IPC::SyncChannel> channel_; |
| 105 | 127 |
| 106 DISALLOW_COPY_AND_ASSIGN(ProxyChannel); | 128 DISALLOW_COPY_AND_ASSIGN(ProxyChannel); |
| 107 }; | 129 }; |
| 108 | 130 |
| 109 } // namespace proxy | 131 } // namespace proxy |
| 110 } // namespace ppapi | 132 } // namespace ppapi |
| 111 | 133 |
| 112 #endif // PPAPI_PROXY_PROXY_CHANNEL_H_ | 134 #endif // PPAPI_PROXY_PROXY_CHANNEL_H_ |
| OLD | NEW |