| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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_PERFTEST_SUPPORT_H_ | 5 #ifndef IPC_IPC_PERFTEST_SUPPORT_H_ |
| 6 #define IPC_IPC_PERFTEST_SUPPORT_H_ | 6 #define IPC_IPC_PERFTEST_SUPPORT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 size_t message_size() const { return message_size_; } | 30 size_t message_size() const { return message_size_; } |
| 31 int message_count() const { return message_count_; } | 31 int message_count() const { return message_count_; } |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 size_t message_size_; | 34 size_t message_size_; |
| 35 int message_count_; | 35 int message_count_; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 class IPCChannelPerfTestBase : public IPCTestBase { | 38 class IPCChannelPerfTestBase : public IPCChannelMojoTestBase { |
| 39 public: | 39 public: |
| 40 IPCChannelPerfTestBase(); | 40 IPCChannelPerfTestBase(); |
| 41 ~IPCChannelPerfTestBase() override; | 41 ~IPCChannelPerfTestBase() override; |
| 42 | 42 |
| 43 static std::vector<PingPongTestParams> GetDefaultTestParams(); | 43 static std::vector<PingPongTestParams> GetDefaultTestParams(); |
| 44 | 44 |
| 45 void RunTestChannelPingPong( | 45 void RunTestChannelPingPong( |
| 46 const std::vector<PingPongTestParams>& params_list); | 46 const std::vector<PingPongTestParams>& params_list); |
| 47 void RunTestChannelProxyPingPong( | 47 void RunTestChannelProxyPingPong( |
| 48 const std::vector<PingPongTestParams>& params_list); | 48 const std::vector<PingPongTestParams>& params_list); |
| 49 | 49 |
| 50 scoped_refptr<base::TaskRunner> io_task_runner() { | 50 scoped_refptr<base::TaskRunner> io_task_runner() { |
| 51 if (io_thread_) | 51 if (io_thread_) |
| 52 return io_thread_->task_runner(); | 52 return io_thread_->task_runner(); |
| 53 return base::ThreadTaskRunnerHandle::Get(); | 53 return base::ThreadTaskRunnerHandle::Get(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 std::unique_ptr<base::TestIOThread> io_thread_; | 57 std::unique_ptr<base::TestIOThread> io_thread_; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 class PingPongTestClient { | 60 class PingPongTestClient { |
| 61 public: | 61 public: |
| 62 PingPongTestClient(); | 62 PingPongTestClient(); |
| 63 virtual ~PingPongTestClient(); | 63 virtual ~PingPongTestClient(); |
| 64 | 64 |
| 65 virtual std::unique_ptr<Channel> CreateChannel(Listener* listener); | 65 virtual std::unique_ptr<Channel> CreateChannel(Listener* listener) = 0; |
| 66 int RunMain(); | 66 int RunMain(); |
| 67 scoped_refptr<base::TaskRunner> task_runner(); | 67 scoped_refptr<base::TaskRunner> task_runner(); |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 base::MessageLoopForIO main_message_loop_; | 70 base::MessageLoopForIO main_message_loop_; |
| 71 std::unique_ptr<ChannelReflectorListener> listener_; | 71 std::unique_ptr<ChannelReflectorListener> listener_; |
| 72 std::unique_ptr<Channel> channel_; | 72 std::unique_ptr<Channel> channel_; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 // This class locks the current thread to a particular CPU core. This is | 75 // This class locks the current thread to a particular CPU core. This is |
| (...skipping 14 matching lines...) Expand all Loading... |
| 90 cpu_set_t old_cpuset_; | 90 cpu_set_t old_cpuset_; |
| 91 #endif | 91 #endif |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(LockThreadAffinity); | 93 DISALLOW_COPY_AND_ASSIGN(LockThreadAffinity); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 #endif // IPC_IPC_PERFTEST_SUPPORT_H_ | 99 #endif // IPC_IPC_PERFTEST_SUPPORT_H_ |
| OLD | NEW |