blob: 7b4f174c65ca74074e7e7b8b0b7abe65484b38d0 [file] [log] [blame]
[email protected]a7c03d4f32012-01-24 02:36:051// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
[email protected]946d1b22009-07-22 23:57:215#include "ipc/ipc_channel_win.h"
[email protected]c1afbd2c2008-10-13 19:19:366
initial.commit09911bf2008-07-26 23:55:297#include <windows.h>
initial.commit09911bf2008-07-26 23:55:298
[email protected]5be7da242009-11-20 23:16:269#include "base/auto_reset.h"
[email protected]72b6f8e22011-11-12 21:16:4110#include "base/bind.h"
[email protected]c1afbd2c2008-10-13 19:19:3611#include "base/compiler_specific.h"
initial.commit09911bf2008-07-26 23:55:2912#include "base/logging.h"
[email protected]c9177502011-01-01 04:48:4913#include "base/threading/non_thread_safe.h"
[email protected]be1ce6a72010-08-03 14:35:2214#include "base/utf_string_conversions.h"
[email protected]b90d7e802011-01-09 16:32:2015#include "base/win/scoped_handle.h"
[email protected]946d1b22009-07-22 23:57:2116#include "ipc/ipc_logging.h"
17#include "ipc/ipc_message_utils.h"
initial.commit09911bf2008-07-26 23:55:2918
initial.commit09911bf2008-07-26 23:55:2919namespace IPC {
[email protected]935aa542010-10-15 01:59:1520
[email protected]514411fc2008-12-10 22:28:1121Channel::ChannelImpl::State::State(ChannelImpl* channel) : is_pending(false) {
[email protected]17b89142008-11-07 21:52:1522 memset(&context.overlapped, 0, sizeof(context.overlapped));
23 context.handler = channel;
initial.commit09911bf2008-07-26 23:55:2924}
25
[email protected]514411fc2008-12-10 22:28:1126Channel::ChannelImpl::State::~State() {
27 COMPILE_ASSERT(!offsetof(Channel::ChannelImpl::State, context),
28 starts_with_io_context);
initial.commit09911bf2008-07-26 23:55:2929}
30
[email protected]42ce94e2010-12-08 19:28:0931Channel::ChannelImpl::ChannelImpl(const IPC::ChannelHandle &channel_handle,
32 Mode mode, Listener* listener)
[email protected]17b89142008-11-07 21:52:1533 : ALLOW_THIS_IN_INITIALIZER_LIST(input_state_(this)),
34 ALLOW_THIS_IN_INITIALIZER_LIST(output_state_(this)),
35 pipe_(INVALID_HANDLE_VALUE),
initial.commit09911bf2008-07-26 23:55:2936 listener_(listener),
[email protected]1707726c2011-02-03 20:35:0937 waiting_connect_(mode & MODE_SERVER_FLAG),
[email protected]c1afbd2c2008-10-13 19:19:3638 processing_incoming_(false),
[email protected]72b6f8e22011-11-12 21:16:4139 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
[email protected]c2391b82011-05-06 17:39:0740 CreatePipe(channel_handle, mode);
initial.commit09911bf2008-07-26 23:55:2941}
42
[email protected]601858c02010-09-01 17:08:2043Channel::ChannelImpl::~ChannelImpl() {
44 Close();
45}
46
[email protected]514411fc2008-12-10 22:28:1147void Channel::ChannelImpl::Close() {
[email protected]c1e4bff32009-01-29 00:07:0648 if (thread_check_.get()) {
49 DCHECK(thread_check_->CalledOnValidThread());
50 }
51
[email protected]74f87acf22009-10-14 22:10:4052 if (input_state_.is_pending || output_state_.is_pending)
[email protected]17b89142008-11-07 21:52:1553 CancelIo(pipe_);
[email protected]ee78622d2008-10-13 21:25:5054
[email protected]17b89142008-11-07 21:52:1555 // Closing the handle at this point prevents us from issuing more requests
56 // form OnIOCompleted().
initial.commit09911bf2008-07-26 23:55:2957 if (pipe_ != INVALID_HANDLE_VALUE) {
58 CloseHandle(pipe_);
59 pipe_ = INVALID_HANDLE_VALUE;
60 }
61
[email protected]17b89142008-11-07 21:52:1562 // Make sure all IO has completed.
63 base::Time start = base::Time::Now();
64 while (input_state_.is_pending || output_state_.is_pending) {
65 MessageLoopForIO::current()->WaitForIOCompletion(INFINITE, this);
66 }
[email protected]17b89142008-11-07 21:52:1567
initial.commit09911bf2008-07-26 23:55:2968 while (!output_queue_.empty()) {
69 Message* m = output_queue_.front();
70 output_queue_.pop();
71 delete m;
72 }
73}
74
[email protected]514411fc2008-12-10 22:28:1175bool Channel::ChannelImpl::Send(Message* message) {
[email protected]c1e4bff32009-01-29 00:07:0676 DCHECK(thread_check_->CalledOnValidThread());
[email protected]2a9d601b2010-10-19 23:50:0077 DVLOG(2) << "sending message @" << message << " on channel @" << this
78 << " with type " << message->type()
79 << " (" << output_queue_.size() << " in queue)";
initial.commit09911bf2008-07-26 23:55:2980
81#ifdef IPC_MESSAGE_LOG_ENABLED
[email protected]8e8bb6d2010-12-13 08:18:5582 Logging::GetInstance()->OnSendMessage(message, "");
initial.commit09911bf2008-07-26 23:55:2983#endif
84
85 output_queue_.push(message);
86 // ensure waiting to write
87 if (!waiting_connect_) {
88 if (!output_state_.is_pending) {
[email protected]c1afbd2c2008-10-13 19:19:3689 if (!ProcessOutgoingMessages(NULL, 0))
initial.commit09911bf2008-07-26 23:55:2990 return false;
initial.commit09911bf2008-07-26 23:55:2991 }
92 }
93
94 return true;
95}
96
[email protected]313c00e52011-08-09 06:46:0697// static
98bool Channel::ChannelImpl::IsNamedServerInitialized(
99 const std::string& channel_id) {
100 if (WaitNamedPipe(PipeName(channel_id).c_str(), 1))
101 return true;
102 // If ERROR_SEM_TIMEOUT occurred, the pipe exists but is handling another
103 // connection.
104 return GetLastError() == ERROR_SEM_TIMEOUT;
105}
106
107// static
[email protected]d3216442009-03-05 21:07:27108const std::wstring Channel::ChannelImpl::PipeName(
[email protected]313c00e52011-08-09 06:46:06109 const std::string& channel_id) {
[email protected]c2391b82011-05-06 17:39:07110 std::string name("\\\\.\\pipe\\chrome.");
111 return ASCIIToWide(name.append(channel_id));
initial.commit09911bf2008-07-26 23:55:29112}
113
[email protected]42ce94e2010-12-08 19:28:09114bool Channel::ChannelImpl::CreatePipe(const IPC::ChannelHandle &channel_handle,
[email protected]514411fc2008-12-10 22:28:11115 Mode mode) {
[email protected]5e0be642011-04-28 18:20:09116 DCHECK_EQ(INVALID_HANDLE_VALUE, pipe_);
[email protected]a7c03d4f32012-01-24 02:36:05117 string16 pipe_name;
118 // If we already have a valid pipe for channel just copy it.
119 if (channel_handle.pipe.handle) {
120 DCHECK(channel_handle.name.empty());
121 pipe_name = L"Not Available"; // Just used for LOG
122 // Check that the given pipe confirms to the specified mode. We can
123 // only check for PIPE_TYPE_MESSAGE & PIPE_SERVER_END flags since the
124 // other flags (PIPE_TYPE_BYTE, and PIPE_CLIENT_END) are defined as 0.
125 DWORD flags = 0;
126 GetNamedPipeInfo(channel_handle.pipe.handle, &flags, NULL, NULL, NULL);
127 DCHECK(!(flags & PIPE_TYPE_MESSAGE));
128 if (((mode & MODE_SERVER_FLAG) && !(flags & PIPE_SERVER_END)) ||
129 ((mode & MODE_CLIENT_FLAG) && (flags & PIPE_SERVER_END))) {
130 LOG(WARNING) << "Inconsistent open mode. Mode :" << mode;
131 return false;
132 }
133 if (!DuplicateHandle(GetCurrentProcess(),
134 channel_handle.pipe.handle,
135 GetCurrentProcess(),
136 &pipe_,
137 0,
138 FALSE,
139 DUPLICATE_SAME_ACCESS)) {
140 LOG(WARNING) << "DuplicateHandle failed. Error :" << GetLastError();
141 return false;
142 }
143 } else if (mode & MODE_SERVER_FLAG) {
144 DCHECK(!channel_handle.pipe.handle);
145 const DWORD open_mode = PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED |
146 FILE_FLAG_FIRST_PIPE_INSTANCE;
147 pipe_name = PipeName(channel_handle.name);
initial.commit09911bf2008-07-26 23:55:29148 pipe_ = CreateNamedPipeW(pipe_name.c_str(),
[email protected]a7c03d4f32012-01-24 02:36:05149 open_mode,
initial.commit09911bf2008-07-26 23:55:29150 PIPE_TYPE_BYTE | PIPE_READMODE_BYTE,
[email protected]c2391b82011-05-06 17:39:07151 1,
[email protected]514411fc2008-12-10 22:28:11152 Channel::kReadBufferSize,
[email protected]514411fc2008-12-10 22:28:11153 Channel::kReadBufferSize,
[email protected]c2391b82011-05-06 17:39:07154 5000,
155 NULL);
[email protected]1707726c2011-02-03 20:35:09156 } else if (mode & MODE_CLIENT_FLAG) {
[email protected]a7c03d4f32012-01-24 02:36:05157 DCHECK(!channel_handle.pipe.handle);
158 pipe_name = PipeName(channel_handle.name);
initial.commit09911bf2008-07-26 23:55:29159 pipe_ = CreateFileW(pipe_name.c_str(),
160 GENERIC_READ | GENERIC_WRITE,
161 0,
162 NULL,
163 OPEN_EXISTING,
164 SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION |
165 FILE_FLAG_OVERLAPPED,
166 NULL);
[email protected]1707726c2011-02-03 20:35:09167 } else {
168 NOTREACHED();
initial.commit09911bf2008-07-26 23:55:29169 }
[email protected]a7c03d4f32012-01-24 02:36:05170
initial.commit09911bf2008-07-26 23:55:29171 if (pipe_ == INVALID_HANDLE_VALUE) {
172 // If this process is being closed, the pipe may be gone already.
[email protected]c2391b82011-05-06 17:39:07173 LOG(WARNING) << "Unable to create pipe \"" << pipe_name <<
174 "\" in " << (mode == 0 ? "server" : "client")
175 << " mode. Error :" << GetLastError();
initial.commit09911bf2008-07-26 23:55:29176 return false;
177 }
178
179 // Create the Hello message to be sent when Connect is called
180 scoped_ptr<Message> m(new Message(MSG_ROUTING_NONE,
181 HELLO_MESSAGE_TYPE,
182 IPC::Message::PRIORITY_NORMAL));
183 if (!m->WriteInt(GetCurrentProcessId())) {
184 CloseHandle(pipe_);
185 pipe_ = INVALID_HANDLE_VALUE;
186 return false;
187 }
188
189 output_queue_.push(m.release());
190 return true;
191}
192
[email protected]514411fc2008-12-10 22:28:11193bool Channel::ChannelImpl::Connect() {
[email protected]19340722009-08-17 19:53:25194 DLOG_IF(WARNING, thread_check_.get()) << "Connect called more than once";
initial.commit09911bf2008-07-26 23:55:29195
[email protected]c1e4bff32009-01-29 00:07:06196 if (!thread_check_.get())
[email protected]c9177502011-01-01 04:48:49197 thread_check_.reset(new base::NonThreadSafe());
[email protected]c1e4bff32009-01-29 00:07:06198
initial.commit09911bf2008-07-26 23:55:29199 if (pipe_ == INVALID_HANDLE_VALUE)
200 return false;
201
[email protected]c1afbd2c2008-10-13 19:19:36202 MessageLoopForIO::current()->RegisterIOHandler(pipe_, this);
203
initial.commit09911bf2008-07-26 23:55:29204 // Check to see if there is a client connected to our pipe...
205 if (waiting_connect_)
206 ProcessConnection();
207
208 if (!input_state_.is_pending) {
[email protected]c1afbd2c2008-10-13 19:19:36209 // Complete setup asynchronously. By not setting input_state_.is_pending
210 // to true, we indicate to OnIOCompleted that this is the special
211 // initialization signal.
[email protected]72b6f8e22011-11-12 21:16:41212 MessageLoopForIO::current()->PostTask(
213 FROM_HERE, base::Bind(&Channel::ChannelImpl::OnIOCompleted,
214 weak_factory_.GetWeakPtr(), &input_state_.context,
215 0, 0));
initial.commit09911bf2008-07-26 23:55:29216 }
217
218 if (!waiting_connect_)
[email protected]c1afbd2c2008-10-13 19:19:36219 ProcessOutgoingMessages(NULL, 0);
initial.commit09911bf2008-07-26 23:55:29220 return true;
221}
222
[email protected]514411fc2008-12-10 22:28:11223bool Channel::ChannelImpl::ProcessConnection() {
[email protected]c1e4bff32009-01-29 00:07:06224 DCHECK(thread_check_->CalledOnValidThread());
[email protected]17b89142008-11-07 21:52:15225 if (input_state_.is_pending)
[email protected]c1afbd2c2008-10-13 19:19:36226 input_state_.is_pending = false;
initial.commit09911bf2008-07-26 23:55:29227
228 // Do we have a client connected to our pipe?
[email protected]17b89142008-11-07 21:52:15229 if (INVALID_HANDLE_VALUE == pipe_)
230 return false;
231
232 BOOL ok = ConnectNamedPipe(pipe_, &input_state_.context.overlapped);
initial.commit09911bf2008-07-26 23:55:29233
234 DWORD err = GetLastError();
235 if (ok) {
236 // Uhm, the API documentation says that this function should never
237 // return success when used in overlapped mode.
238 NOTREACHED();
239 return false;
240 }
241
242 switch (err) {
243 case ERROR_IO_PENDING:
244 input_state_.is_pending = true;
initial.commit09911bf2008-07-26 23:55:29245 break;
246 case ERROR_PIPE_CONNECTED:
247 waiting_connect_ = false;
248 break;
[email protected]20aa32c2009-07-14 22:25:49249 case ERROR_NO_DATA:
250 // The pipe is being closed.
251 return false;
initial.commit09911bf2008-07-26 23:55:29252 default:
253 NOTREACHED();
254 return false;
255 }
256
257 return true;
258}
259
[email protected]514411fc2008-12-10 22:28:11260bool Channel::ChannelImpl::ProcessIncomingMessages(
261 MessageLoopForIO::IOContext* context,
262 DWORD bytes_read) {
[email protected]c1e4bff32009-01-29 00:07:06263 DCHECK(thread_check_->CalledOnValidThread());
initial.commit09911bf2008-07-26 23:55:29264 if (input_state_.is_pending) {
265 input_state_.is_pending = false;
[email protected]c1afbd2c2008-10-13 19:19:36266 DCHECK(context);
initial.commit09911bf2008-07-26 23:55:29267
[email protected]c1afbd2c2008-10-13 19:19:36268 if (!context || !bytes_read)
initial.commit09911bf2008-07-26 23:55:29269 return false;
initial.commit09911bf2008-07-26 23:55:29270 } else {
[email protected]c1afbd2c2008-10-13 19:19:36271 // This happens at channel initialization.
[email protected]17b89142008-11-07 21:52:15272 DCHECK(!bytes_read && context == &input_state_.context);
initial.commit09911bf2008-07-26 23:55:29273 }
274
275 for (;;) {
276 if (bytes_read == 0) {
[email protected]17b89142008-11-07 21:52:15277 if (INVALID_HANDLE_VALUE == pipe_)
278 return false;
279
[email protected]c1afbd2c2008-10-13 19:19:36280 // Read from pipe...
initial.commit09911bf2008-07-26 23:55:29281 BOOL ok = ReadFile(pipe_,
282 input_buf_,
[email protected]514411fc2008-12-10 22:28:11283 Channel::kReadBufferSize,
initial.commit09911bf2008-07-26 23:55:29284 &bytes_read,
[email protected]17b89142008-11-07 21:52:15285 &input_state_.context.overlapped);
initial.commit09911bf2008-07-26 23:55:29286 if (!ok) {
287 DWORD err = GetLastError();
288 if (err == ERROR_IO_PENDING) {
initial.commit09911bf2008-07-26 23:55:29289 input_state_.is_pending = true;
290 return true;
291 }
292 LOG(ERROR) << "pipe error: " << err;
293 return false;
294 }
[email protected]17b89142008-11-07 21:52:15295 input_state_.is_pending = true;
296 return true;
initial.commit09911bf2008-07-26 23:55:29297 }
298 DCHECK(bytes_read);
299
[email protected]c1afbd2c2008-10-13 19:19:36300 // Process messages from input buffer.
initial.commit09911bf2008-07-26 23:55:29301
302 const char* p, *end;
303 if (input_overflow_buf_.empty()) {
304 p = input_buf_;
305 end = p + bytes_read;
306 } else {
307 if (input_overflow_buf_.size() > (kMaximumMessageSize - bytes_read)) {
308 input_overflow_buf_.clear();
309 LOG(ERROR) << "IPC message is too big";
310 return false;
311 }
312 input_overflow_buf_.append(input_buf_, bytes_read);
313 p = input_overflow_buf_.data();
314 end = p + input_overflow_buf_.size();
315 }
316
317 while (p < end) {
318 const char* message_tail = Message::FindNext(p, end);
319 if (message_tail) {
320 int len = static_cast<int>(message_tail - p);
321 const Message m(p, len);
[email protected]2a9d601b2010-10-19 23:50:00322 DVLOG(2) << "received message on channel @" << this
323 << " with type " << m.type();
initial.commit09911bf2008-07-26 23:55:29324 if (m.routing_id() == MSG_ROUTING_NONE &&
325 m.type() == HELLO_MESSAGE_TYPE) {
326 // The Hello message contains only the process id.
327 listener_->OnChannelConnected(MessageIterator(m).NextInt());
328 } else {
329 listener_->OnMessageReceived(m);
330 }
331 p = message_tail;
332 } else {
[email protected]c1afbd2c2008-10-13 19:19:36333 // Last message is partial.
initial.commit09911bf2008-07-26 23:55:29334 break;
335 }
336 }
337 input_overflow_buf_.assign(p, end - p);
338
[email protected]c1afbd2c2008-10-13 19:19:36339 bytes_read = 0; // Get more data.
initial.commit09911bf2008-07-26 23:55:29340 }
341
342 return true;
343}
344
[email protected]514411fc2008-12-10 22:28:11345bool Channel::ChannelImpl::ProcessOutgoingMessages(
346 MessageLoopForIO::IOContext* context,
347 DWORD bytes_written) {
initial.commit09911bf2008-07-26 23:55:29348 DCHECK(!waiting_connect_); // Why are we trying to send messages if there's
349 // no connection?
[email protected]c1e4bff32009-01-29 00:07:06350 DCHECK(thread_check_->CalledOnValidThread());
initial.commit09911bf2008-07-26 23:55:29351
352 if (output_state_.is_pending) {
[email protected]c1afbd2c2008-10-13 19:19:36353 DCHECK(context);
initial.commit09911bf2008-07-26 23:55:29354 output_state_.is_pending = false;
[email protected]c1afbd2c2008-10-13 19:19:36355 if (!context || bytes_written == 0) {
initial.commit09911bf2008-07-26 23:55:29356 DWORD err = GetLastError();
357 LOG(ERROR) << "pipe error: " << err;
358 return false;
359 }
[email protected]c1afbd2c2008-10-13 19:19:36360 // Message was sent.
initial.commit09911bf2008-07-26 23:55:29361 DCHECK(!output_queue_.empty());
362 Message* m = output_queue_.front();
363 output_queue_.pop();
364 delete m;
365 }
366
[email protected]17b89142008-11-07 21:52:15367 if (output_queue_.empty())
368 return true;
369
370 if (INVALID_HANDLE_VALUE == pipe_)
371 return false;
372
373 // Write to pipe...
374 Message* m = output_queue_.front();
[email protected]8a861402011-01-28 19:59:11375 DCHECK(m->size() <= INT_MAX);
[email protected]17b89142008-11-07 21:52:15376 BOOL ok = WriteFile(pipe_,
377 m->data(),
[email protected]8a861402011-01-28 19:59:11378 static_cast<int>(m->size()),
[email protected]17b89142008-11-07 21:52:15379 &bytes_written,
380 &output_state_.context.overlapped);
381 if (!ok) {
382 DWORD err = GetLastError();
383 if (err == ERROR_IO_PENDING) {
384 output_state_.is_pending = true;
initial.commit09911bf2008-07-26 23:55:29385
[email protected]2a9d601b2010-10-19 23:50:00386 DVLOG(2) << "sent pending message @" << m << " on channel @" << this
387 << " with type " << m->type();
initial.commit09911bf2008-07-26 23:55:29388
[email protected]17b89142008-11-07 21:52:15389 return true;
initial.commit09911bf2008-07-26 23:55:29390 }
[email protected]17b89142008-11-07 21:52:15391 LOG(ERROR) << "pipe error: " << err;
392 return false;
initial.commit09911bf2008-07-26 23:55:29393 }
394
[email protected]2a9d601b2010-10-19 23:50:00395 DVLOG(2) << "sent message @" << m << " on channel @" << this
396 << " with type " << m->type();
[email protected]17b89142008-11-07 21:52:15397
398 output_state_.is_pending = true;
initial.commit09911bf2008-07-26 23:55:29399 return true;
400}
401
[email protected]514411fc2008-12-10 22:28:11402void Channel::ChannelImpl::OnIOCompleted(MessageLoopForIO::IOContext* context,
[email protected]17b89142008-11-07 21:52:15403 DWORD bytes_transfered, DWORD error) {
initial.commit09911bf2008-07-26 23:55:29404 bool ok;
[email protected]c1e4bff32009-01-29 00:07:06405 DCHECK(thread_check_->CalledOnValidThread());
[email protected]17b89142008-11-07 21:52:15406 if (context == &input_state_.context) {
initial.commit09911bf2008-07-26 23:55:29407 if (waiting_connect_) {
[email protected]17b89142008-11-07 21:52:15408 if (!ProcessConnection())
409 return;
initial.commit09911bf2008-07-26 23:55:29410 // We may have some messages queued up to send...
411 if (!output_queue_.empty() && !output_state_.is_pending)
[email protected]c1afbd2c2008-10-13 19:19:36412 ProcessOutgoingMessages(NULL, 0);
initial.commit09911bf2008-07-26 23:55:29413 if (input_state_.is_pending)
414 return;
415 // else, fall-through and look for incoming messages...
416 }
417 // we don't support recursion through OnMessageReceived yet!
418 DCHECK(!processing_incoming_);
[email protected]0fbd70332010-06-01 19:28:34419 AutoReset<bool> auto_reset_processing_incoming(&processing_incoming_, true);
[email protected]c1afbd2c2008-10-13 19:19:36420 ok = ProcessIncomingMessages(context, bytes_transfered);
initial.commit09911bf2008-07-26 23:55:29421 } else {
[email protected]17b89142008-11-07 21:52:15422 DCHECK(context == &output_state_.context);
[email protected]c1afbd2c2008-10-13 19:19:36423 ok = ProcessOutgoingMessages(context, bytes_transfered);
initial.commit09911bf2008-07-26 23:55:29424 }
[email protected]17b89142008-11-07 21:52:15425 if (!ok && INVALID_HANDLE_VALUE != pipe_) {
426 // We don't want to re-enter Close().
initial.commit09911bf2008-07-26 23:55:29427 Close();
428 listener_->OnChannelError();
429 }
430}
431
[email protected]514411fc2008-12-10 22:28:11432//------------------------------------------------------------------------------
433// Channel's methods simply call through to ChannelImpl.
[email protected]42ce94e2010-12-08 19:28:09434Channel::Channel(const IPC::ChannelHandle &channel_handle, Mode mode,
[email protected]514411fc2008-12-10 22:28:11435 Listener* listener)
[email protected]42ce94e2010-12-08 19:28:09436 : channel_impl_(new ChannelImpl(channel_handle, mode, listener)) {
initial.commit09911bf2008-07-26 23:55:29437}
[email protected]514411fc2008-12-10 22:28:11438
439Channel::~Channel() {
440 delete channel_impl_;
441}
442
443bool Channel::Connect() {
444 return channel_impl_->Connect();
445}
446
447void Channel::Close() {
448 channel_impl_->Close();
449}
450
451void Channel::set_listener(Listener* listener) {
452 channel_impl_->set_listener(listener);
453}
454
455bool Channel::Send(Message* message) {
456 return channel_impl_->Send(message);
457}
458
[email protected]313c00e52011-08-09 06:46:06459// static
460bool Channel::IsNamedServerInitialized(const std::string& channel_id) {
461 return ChannelImpl::IsNamedServerInitialized(channel_id);
462}
463
[email protected]514411fc2008-12-10 22:28:11464} // namespace IPC