| 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_sync_channel.h" | 5 #include "ipc/ipc_sync_channel.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 ~Worker() override { | 77 ~Worker() override { |
| 78 // Shutdown() must be called before destruction. | 78 // Shutdown() must be called before destruction. |
| 79 CHECK(is_shutdown_); | 79 CHECK(is_shutdown_); |
| 80 } | 80 } |
| 81 void AddRef() { } | 81 void AddRef() { } |
| 82 void Release() { } | 82 void Release() { } |
| 83 bool Send(Message* msg) override { return channel_->Send(msg); } | 83 bool Send(Message* msg) override { return channel_->Send(msg); } |
| 84 void WaitForChannelCreation() { channel_created_->Wait(); } | 84 void WaitForChannelCreation() { channel_created_->Wait(); } |
| 85 void CloseChannel() { | 85 void CloseChannel() { |
| 86 DCHECK(base::MessageLoop::current() == ListenerThread()->message_loop()); | 86 DCHECK(ListenerThread()->task_runner()->BelongsToCurrentThread()); |
| 87 channel_->Close(); | 87 channel_->Close(); |
| 88 } | 88 } |
| 89 void Start() { | 89 void Start() { |
| 90 StartThread(&listener_thread_, base::MessageLoop::TYPE_DEFAULT); | 90 StartThread(&listener_thread_, base::MessageLoop::TYPE_DEFAULT); |
| 91 ListenerThread()->task_runner()->PostTask( | 91 ListenerThread()->task_runner()->PostTask( |
| 92 FROM_HERE, base::Bind(&Worker::OnStart, this)); | 92 FROM_HERE, base::Bind(&Worker::OnStart, this)); |
| 93 } | 93 } |
| 94 void Shutdown() { | 94 void Shutdown() { |
| 95 // The IPC thread needs to outlive SyncChannel. We can't do this in | 95 // The IPC thread needs to outlive SyncChannel. We can't do this in |
| 96 // ~Worker(), since that'll reset the vtable pointer (to Worker's), which | 96 // ~Worker(), since that'll reset the vtable pointer (to Worker's), which |
| (...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 } | 1856 } |
| 1857 | 1857 |
| 1858 // Windows needs to send an out-of-band secret to verify the client end of the | 1858 // Windows needs to send an out-of-band secret to verify the client end of the |
| 1859 // channel. Test that we still connect correctly in that case. | 1859 // channel. Test that we still connect correctly in that case. |
| 1860 TEST_F(IPCSyncChannelTest, Verified) { | 1860 TEST_F(IPCSyncChannelTest, Verified) { |
| 1861 Verified(); | 1861 Verified(); |
| 1862 } | 1862 } |
| 1863 | 1863 |
| 1864 } // namespace | 1864 } // namespace |
| 1865 } // namespace IPC | 1865 } // namespace IPC |
| OLD | NEW |