Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: ipc/ipc_sync_channel_unittest.cc

Issue 2080423002: Remove calls to MessageLoop::current() in ipc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/ipc_logging.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ipc/ipc_logging.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698