OLD | NEW |
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 11 matching lines...) Expand all Loading... |
22 double MojoTicksToSeconds(MojoTimeTicks ticks) { | 22 double MojoTicksToSeconds(MojoTimeTicks ticks) { |
23 return ticks / kMojoTicksPerSecond; | 23 return ticks / kMojoTicksPerSecond; |
24 } | 24 } |
25 | 25 |
26 class PingServiceImpl : public test::PingService { | 26 class PingServiceImpl : public test::PingService { |
27 public: | 27 public: |
28 PingServiceImpl() {} | 28 PingServiceImpl() {} |
29 ~PingServiceImpl() override {} | 29 ~PingServiceImpl() override {} |
30 | 30 |
31 // |PingService| methods: | 31 // |PingService| methods: |
32 void Ping(const PingCallback& callback) override; | 32 void Ping(const Callback<void()>& callback) override; |
33 | 33 |
34 private: | 34 private: |
35 DISALLOW_COPY_AND_ASSIGN(PingServiceImpl); | 35 DISALLOW_COPY_AND_ASSIGN(PingServiceImpl); |
36 }; | 36 }; |
37 | 37 |
38 void PingServiceImpl::Ping(const PingCallback& callback) { | 38 void PingServiceImpl::Ping(const Callback<void()>& callback) { |
39 callback.Run(); | 39 callback.Run(); |
40 } | 40 } |
41 | 41 |
42 class PingPongTest { | 42 class PingPongTest { |
43 public: | 43 public: |
44 explicit PingPongTest(test::PingServicePtr service); | 44 explicit PingPongTest(test::PingServicePtr service); |
45 | 45 |
46 void Run(unsigned int iterations); | 46 void Run(unsigned int iterations); |
47 | 47 |
48 private: | 48 private: |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 "InProcessPingPong", "1000_Inactive", | 128 "InProcessPingPong", "1000_Inactive", |
129 kIterations / MojoTicksToSeconds(end_time - start_time), | 129 kIterations / MojoTicksToSeconds(end_time - start_time), |
130 "pings/second"); | 130 "pings/second"); |
131 | 131 |
132 delete[] inactive_services; | 132 delete[] inactive_services; |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 } // namespace | 136 } // namespace |
137 } // namespace mojo | 137 } // namespace mojo |
OLD | NEW |