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 #include "ipc/ipc_channel_win.h" | 5 #include "ipc/ipc_channel_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 455 |
456 Channel::~Channel() { | 456 Channel::~Channel() { |
457 delete channel_impl_; | 457 delete channel_impl_; |
458 } | 458 } |
459 | 459 |
460 bool Channel::Connect() { | 460 bool Channel::Connect() { |
461 return channel_impl_->Connect(); | 461 return channel_impl_->Connect(); |
462 } | 462 } |
463 | 463 |
464 void Channel::Close() { | 464 void Channel::Close() { |
465 channel_impl_->Close(); | 465 if (channel_impl_) |
| 466 channel_impl_->Close(); |
466 } | 467 } |
467 | 468 |
468 void Channel::set_listener(Listener* listener) { | 469 void Channel::set_listener(Listener* listener) { |
469 channel_impl_->set_listener(listener); | 470 channel_impl_->set_listener(listener); |
470 } | 471 } |
471 | 472 |
472 base::ProcessId Channel::peer_pid() const { | 473 base::ProcessId Channel::peer_pid() const { |
473 return channel_impl_->peer_pid(); | 474 return channel_impl_->peer_pid(); |
474 } | 475 } |
475 | 476 |
(...skipping 20 matching lines...) Expand all Loading... |
496 int secret; | 497 int secret; |
497 do { // Guarantee we get a non-zero value. | 498 do { // Guarantee we get a non-zero value. |
498 secret = base::RandInt(0, std::numeric_limits<int>::max()); | 499 secret = base::RandInt(0, std::numeric_limits<int>::max()); |
499 } while (secret == 0); | 500 } while (secret == 0); |
500 | 501 |
501 id.append(GenerateUniqueRandomChannelID()); | 502 id.append(GenerateUniqueRandomChannelID()); |
502 return id.append(base::StringPrintf("\\%d", secret)); | 503 return id.append(base::StringPrintf("\\%d", secret)); |
503 } | 504 } |
504 | 505 |
505 } // namespace IPC | 506 } // namespace IPC |
OLD | NEW |