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

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: Comments from tsepez. Created 4 years, 8 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
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 <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...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(scoped_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 scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( 116 virtual scoped_ptr<IPC::ChannelFactory> CreateChannelFactory(
113 const IPC::ChannelHandle& handle, base::SequencedTaskRunner* runner); 117 const IPC::ChannelHandle& handle, base::SequencedTaskRunner* runner);
114 118
115 virtual bool DidStartClient(); 119 virtual bool DidStartClient();
116 120
117 private: 121 private:
118 std::string GetTestMainName() const; 122 std::string GetTestMainName() const;
119 123
120 std::string test_client_name_; 124 std::string test_client_name_;
121 scoped_ptr<base::MessageLoop> message_loop_; 125 scoped_ptr<base::MessageLoop> message_loop_;
122 126
123 scoped_ptr<IPC::Channel> channel_; 127 scoped_ptr<IPC::Channel> channel_;
124 scoped_ptr<IPC::ChannelProxy> channel_proxy_; 128 scoped_ptr<IPC::ChannelProxy> channel_proxy_;
125 129
126 base::Process client_process_; 130 base::Process client_process_;
127 131
128 DISALLOW_COPY_AND_ASSIGN(IPCTestBase); 132 DISALLOW_COPY_AND_ASSIGN(IPCTestBase);
129 }; 133 };
130 134
131 // Use this to declare the client side for tests using IPCTestBase. 135 // Use this to declare the client side for tests using IPCTestBase.
132 #define MULTIPROCESS_IPC_TEST_CLIENT_MAIN(test_client_name) \ 136 #define MULTIPROCESS_IPC_TEST_CLIENT_MAIN(test_client_name) \
133 MULTIPROCESS_IPC_TEST_MAIN(test_client_name ## TestClientMain) 137 MULTIPROCESS_IPC_TEST_MAIN(test_client_name ## TestClientMain)
134 138
135 #endif // IPC_IPC_TEST_BASE_H_ 139 #endif // IPC_IPC_TEST_BASE_H_
OLDNEW
« ipc/ipc_channel_proxy.cc ('K') | « 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