| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 IPC_IPC_CHANNEL_WIN_H_ | 5 #ifndef IPC_IPC_CHANNEL_WIN_H_ |
| 6 #define IPC_IPC_CHANNEL_WIN_H_ | 6 #define IPC_IPC_CHANNEL_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ipc/ipc_channel.h" | 9 #include "ipc/ipc_channel.h" |
| 10 | 10 |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 16 | 16 |
| 17 class NonThreadSafe; | 17 class NonThreadSafe; |
| 18 | 18 |
| 19 namespace IPC { | 19 namespace IPC { |
| 20 | 20 |
| 21 class Channel::ChannelImpl : public MessageLoopForIO::IOHandler { | 21 class Channel::ChannelImpl : public MessageLoopForIO::IOHandler { |
| 22 public: | 22 public: |
| 23 // Mirror methods of Channel, see ipc_channel.h for description. | 23 // Mirror methods of Channel, see ipc_channel.h for description. |
| 24 ChannelImpl(const std::string& channel_id, Mode mode, Listener* listener); | 24 ChannelImpl(const IPC::ChannelHandle &channel_handle, Mode mode, |
| 25 Listener* listener); |
| 25 ~ChannelImpl(); | 26 ~ChannelImpl(); |
| 26 bool Connect(); | 27 bool Connect(); |
| 27 void Close(); | 28 void Close(); |
| 28 void set_listener(Listener* listener) { listener_ = listener; } | 29 void set_listener(Listener* listener) { listener_ = listener; } |
| 29 bool Send(Message* message); | 30 bool Send(Message* message); |
| 30 private: | 31 private: |
| 31 const std::wstring PipeName(const std::string& channel_id) const; | 32 const std::wstring PipeName(const std::string& channel_id) const; |
| 32 bool CreatePipe(const std::string& channel_id, Mode mode); | 33 bool CreatePipe(const IPC::ChannelHandle &channel_handle, Mode mode); |
| 33 | 34 |
| 34 bool ProcessConnection(); | 35 bool ProcessConnection(); |
| 35 bool ProcessIncomingMessages(MessageLoopForIO::IOContext* context, | 36 bool ProcessIncomingMessages(MessageLoopForIO::IOContext* context, |
| 36 DWORD bytes_read); | 37 DWORD bytes_read); |
| 37 bool ProcessOutgoingMessages(MessageLoopForIO::IOContext* context, | 38 bool ProcessOutgoingMessages(MessageLoopForIO::IOContext* context, |
| 38 DWORD bytes_written); | 39 DWORD bytes_written); |
| 39 | 40 |
| 40 // MessageLoop::IOHandler implementation. | 41 // MessageLoop::IOHandler implementation. |
| 41 virtual void OnIOCompleted(MessageLoopForIO::IOContext* context, | 42 virtual void OnIOCompleted(MessageLoopForIO::IOContext* context, |
| 42 DWORD bytes_transfered, DWORD error); | 43 DWORD bytes_transfered, DWORD error); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 ScopedRunnableMethodFactory<ChannelImpl> factory_; | 79 ScopedRunnableMethodFactory<ChannelImpl> factory_; |
| 79 | 80 |
| 80 scoped_ptr<NonThreadSafe> thread_check_; | 81 scoped_ptr<NonThreadSafe> thread_check_; |
| 81 | 82 |
| 82 DISALLOW_COPY_AND_ASSIGN(ChannelImpl); | 83 DISALLOW_COPY_AND_ASSIGN(ChannelImpl); |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace IPC | 86 } // namespace IPC |
| 86 | 87 |
| 87 #endif // IPC_IPC_CHANNEL_WIN_H_ | 88 #endif // IPC_IPC_CHANNEL_WIN_H_ |
| OLD | NEW |