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

Side by Side Diff: mojo/public/cpp/bindings/tests/bindings_perftest.cc

Issue 2766523002: mojo: MessageReceiver*::AcceptWithResponder() now take a unique_ptr to the responder (Closed)
Patch Set: comments Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return true; 153 return true;
154 } 154 }
155 } 155 }
156 156
157 internal::MessageBuilder builder(count, 0, 8, 0); 157 internal::MessageBuilder builder(count, 0, 8, 0);
158 bool result = sender_->Accept(builder.message()); 158 bool result = sender_->Accept(builder.message());
159 DCHECK(result); 159 DCHECK(result);
160 return true; 160 return true;
161 } 161 }
162 162
163 bool AcceptWithResponder(Message* message, 163 bool AcceptWithResponder(
164 MessageReceiverWithStatus* responder) override { 164 Message* message,
165 std::unique_ptr<MessageReceiverWithStatus> responder) override {
165 NOTREACHED(); 166 NOTREACHED();
166 return true; 167 return true;
167 } 168 }
168 169
169 base::TimeDelta Serve(uint32_t expected_count) { 170 base::TimeDelta Serve(uint32_t expected_count) {
170 base::RunLoop run_loop; 171 base::RunLoop run_loop;
171 172
172 expected_count_ = expected_count; 173 expected_count_ = expected_count;
173 quit_closure_ = run_loop.QuitClosure(); 174 quit_closure_ = run_loop.QuitClosure();
174 175
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 kTestIterations / duration.InSecondsF(), "pings/second"); 226 kTestIterations / duration.InSecondsF(), "pings/second");
226 } 227 }
227 228
228 class CounterReceiver : public MessageReceiverWithResponderStatus { 229 class CounterReceiver : public MessageReceiverWithResponderStatus {
229 public: 230 public:
230 bool Accept(Message* message) override { 231 bool Accept(Message* message) override {
231 counter_++; 232 counter_++;
232 return true; 233 return true;
233 } 234 }
234 235
235 bool AcceptWithResponder(Message* message, 236 bool AcceptWithResponder(
236 MessageReceiverWithStatus* responder) override { 237 Message* message,
238 std::unique_ptr<MessageReceiverWithStatus> responder) override {
237 NOTREACHED(); 239 NOTREACHED();
238 return true; 240 return true;
239 } 241 }
240 242
241 uint32_t counter() const { return counter_; } 243 uint32_t counter() const { return counter_; }
242 244
243 void Reset() { counter_ = 0; } 245 void Reset() { counter_ = 0; }
244 246
245 private: 247 private:
246 uint32_t counter_ = 0; 248 uint32_t counter_ = 0;
(...skipping 28 matching lines...) Expand all
275 if (i == 1) { 277 if (i == 1) {
276 test::LogPerfResult("MultiplexRouterDispatchCost", nullptr, 278 test::LogPerfResult("MultiplexRouterDispatchCost", nullptr,
277 kIterations[i] / duration.InSecondsF(), 279 kIterations[i] / duration.InSecondsF(),
278 "times/second"); 280 "times/second");
279 } 281 }
280 } 282 }
281 } 283 }
282 284
283 } // namespace 285 } // namespace
284 } // namespace mojo 286 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/message.h ('k') | mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698