| 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 #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_listener.h" |
| 11 #include "ipc/ipc_platform_file.h" | 11 #include "ipc/ipc_platform_file.h" |
| 12 #include "ipc/ipc_sender.h" |
| 12 #include "ipc/ipc_sync_channel.h" | 13 #include "ipc/ipc_sync_channel.h" |
| 13 #include "ppapi/proxy/ppapi_proxy_export.h" | 14 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class MessageLoopProxy; | 17 class MessageLoopProxy; |
| 17 class WaitableEvent; | 18 class WaitableEvent; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace IPC { | 21 namespace IPC { |
| 21 class TestSink; | 22 class TestSink; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace ppapi { | 25 namespace ppapi { |
| 25 namespace proxy { | 26 namespace proxy { |
| 26 | 27 |
| 27 class PPAPI_PROXY_EXPORT ProxyChannel | 28 class PPAPI_PROXY_EXPORT ProxyChannel |
| 28 : public IPC::Channel::Listener, | 29 : public IPC::Listener, |
| 29 public IPC::Message::Sender { | 30 public IPC::Sender { |
| 30 public: | 31 public: |
| 31 class PPAPI_PROXY_EXPORT Delegate { | 32 class PPAPI_PROXY_EXPORT Delegate { |
| 32 public: | 33 public: |
| 33 virtual ~Delegate() {} | 34 virtual ~Delegate() {} |
| 34 | 35 |
| 35 // Returns the dedicated message loop for processing IPC requests. | 36 // Returns the dedicated message loop for processing IPC requests. |
| 36 virtual base::MessageLoopProxy* GetIPCMessageLoop() = 0; | 37 virtual base::MessageLoopProxy* GetIPCMessageLoop() = 0; |
| 37 | 38 |
| 38 // Returns the event object that becomes signalled when the main thread's | 39 // Returns the event object that becomes signalled when the main thread's |
| 39 // message loop exits. | 40 // message loop exits. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 60 // Shares a file handle (HANDLE / file descriptor) with the remote side. It | 61 // Shares a file handle (HANDLE / file descriptor) with the remote side. It |
| 61 // returns a handle that should be sent in exactly one IPC message. Upon | 62 // returns a handle that should be sent in exactly one IPC message. Upon |
| 62 // receipt, the remote side then owns that handle. Note: if sending the | 63 // receipt, the remote side then owns that handle. Note: if sending the |
| 63 // message fails, the returned handle is properly closed by the IPC system. If | 64 // message fails, the returned handle is properly closed by the IPC system. If |
| 64 // should_close_source is set to true, the original handle is closed by this | 65 // should_close_source is set to true, the original handle is closed by this |
| 65 // operation and should not be used again. | 66 // operation and should not be used again. |
| 66 IPC::PlatformFileForTransit ShareHandleWithRemote( | 67 IPC::PlatformFileForTransit ShareHandleWithRemote( |
| 67 base::PlatformFile handle, | 68 base::PlatformFile handle, |
| 68 bool should_close_source); | 69 bool should_close_source); |
| 69 | 70 |
| 70 // IPC::Message::Sender implementation. | 71 // IPC::Sender implementation. |
| 71 virtual bool Send(IPC::Message* msg); | 72 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 72 | 73 |
| 73 // IPC::Channel::Listener implementation. | 74 // IPC::Listener implementation. |
| 74 virtual void OnChannelError(); | 75 virtual void OnChannelError() OVERRIDE; |
| 75 | 76 |
| 76 // Will be NULL in some unit tests and if the remote side has crashed. | 77 // Will be NULL in some unit tests and if the remote side has crashed. |
| 77 IPC::SyncChannel* channel() const { | 78 IPC::SyncChannel* channel() const { |
| 78 return channel_.get(); | 79 return channel_.get(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 #if defined(OS_POSIX) && !defined(OS_NACL) | 82 #if defined(OS_POSIX) && !defined(OS_NACL) |
| 82 int TakeRendererFD(); | 83 int TakeRendererFD(); |
| 83 #endif | 84 #endif |
| 84 | 85 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 109 // remote side has crashed. | 110 // remote side has crashed. |
| 110 scoped_ptr<IPC::SyncChannel> channel_; | 111 scoped_ptr<IPC::SyncChannel> channel_; |
| 111 | 112 |
| 112 DISALLOW_COPY_AND_ASSIGN(ProxyChannel); | 113 DISALLOW_COPY_AND_ASSIGN(ProxyChannel); |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 } // namespace proxy | 116 } // namespace proxy |
| 116 } // namespace ppapi | 117 } // namespace ppapi |
| 117 | 118 |
| 118 #endif // PPAPI_PROXY_PROXY_CHANNEL_H_ | 119 #endif // PPAPI_PROXY_PROXY_CHANNEL_H_ |
| OLD | NEW |