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

Side by Side Diff: ipc/ipc_test_base.h

Issue 1903663004: IPC: Fix attachment brokering race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (scoped_ptr->std::unique_ptr) Created 4 years, 7 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_endpoint.h ('k') | ipc/mojo/ipc_channel_mojo.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_TEST_BASE_H_ 5 #ifndef IPC_IPC_TEST_BASE_H_
6 #define IPC_IPC_TEST_BASE_H_ 6 #define IPC_IPC_TEST_BASE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // Use this to send IPC messages (when you don't care if you're using a 99 // Use this to send IPC messages (when you don't care if you're using a
100 // channel or a proxy). 100 // channel or a proxy).
101 IPC::Sender* sender() { 101 IPC::Sender* sender() {
102 return channel_.get() ? static_cast<IPC::Sender*>(channel_.get()) : 102 return channel_.get() ? static_cast<IPC::Sender*>(channel_.get()) :
103 static_cast<IPC::Sender*>(channel_proxy_.get()); 103 static_cast<IPC::Sender*>(channel_proxy_.get());
104 } 104 }
105 105
106 IPC::Channel* channel() { return channel_.get(); } 106 IPC::Channel* channel() { return channel_.get(); }
107 IPC::ChannelProxy* channel_proxy() { return channel_proxy_.get(); } 107 IPC::ChannelProxy* channel_proxy() { return channel_proxy_.get(); }
108 void set_channel_proxy(std::unique_ptr<IPC::ChannelProxy> proxy) {
109 DCHECK(!channel_proxy_);
110 channel_proxy_.swap(proxy);
111 }
108 112
109 const base::Process& client_process() const { return client_process_; } 113 const base::Process& client_process() const { return client_process_; }
110 scoped_refptr<base::SequencedTaskRunner> task_runner(); 114 scoped_refptr<base::SequencedTaskRunner> task_runner();
111 115
112 virtual std::unique_ptr<IPC::ChannelFactory> CreateChannelFactory( 116 virtual std::unique_ptr<IPC::ChannelFactory> CreateChannelFactory(
113 const IPC::ChannelHandle& handle, 117 const IPC::ChannelHandle& handle,
114 base::SequencedTaskRunner* runner); 118 base::SequencedTaskRunner* runner);
115 119
116 virtual bool DidStartClient(); 120 virtual bool DidStartClient();
117 121
118 private: 122 private:
119 std::string GetTestMainName() const; 123 std::string GetTestMainName() const;
120 124
121 std::string test_client_name_; 125 std::string test_client_name_;
122 std::unique_ptr<base::MessageLoop> message_loop_; 126 std::unique_ptr<base::MessageLoop> message_loop_;
123 127
124 std::unique_ptr<IPC::Channel> channel_; 128 std::unique_ptr<IPC::Channel> channel_;
125 std::unique_ptr<IPC::ChannelProxy> channel_proxy_; 129 std::unique_ptr<IPC::ChannelProxy> channel_proxy_;
126 130
127 base::Process client_process_; 131 base::Process client_process_;
128 132
129 DISALLOW_COPY_AND_ASSIGN(IPCTestBase); 133 DISALLOW_COPY_AND_ASSIGN(IPCTestBase);
130 }; 134 };
131 135
132 // Use this to declare the client side for tests using IPCTestBase. 136 // Use this to declare the client side for tests using IPCTestBase.
133 #define MULTIPROCESS_IPC_TEST_CLIENT_MAIN(test_client_name) \ 137 #define MULTIPROCESS_IPC_TEST_CLIENT_MAIN(test_client_name) \
134 MULTIPROCESS_IPC_TEST_MAIN(test_client_name ## TestClientMain) 138 MULTIPROCESS_IPC_TEST_MAIN(test_client_name ## TestClientMain)
135 139
136 #endif // IPC_IPC_TEST_BASE_H_ 140 #endif // IPC_IPC_TEST_BASE_H_
OLDNEW
« no previous file with comments | « ipc/ipc_endpoint.h ('k') | ipc/mojo/ipc_channel_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698