| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ipc/ipc_perftest_support.h" | 5 #include "ipc/ipc_perftest_support.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 virtual ~ChannelReflectorListener() { | 84 virtual ~ChannelReflectorListener() { |
| 85 VLOG(1) << "Client listener down"; | 85 VLOG(1) << "Client listener down"; |
| 86 latency_tracker_.ShowResults(); | 86 latency_tracker_.ShowResults(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void Init(Channel* channel) { | 89 void Init(Channel* channel) { |
| 90 DCHECK(!channel_); | 90 DCHECK(!channel_); |
| 91 channel_ = channel; | 91 channel_ = channel; |
| 92 } | 92 } |
| 93 | 93 |
| 94 virtual bool OnMessageReceived(const Message& message) OVERRIDE { | 94 virtual bool OnMessageReceived(const Message& message) override { |
| 95 CHECK(channel_); | 95 CHECK(channel_); |
| 96 | 96 |
| 97 PickleIterator iter(message); | 97 PickleIterator iter(message); |
| 98 int64 time_internal; | 98 int64 time_internal; |
| 99 EXPECT_TRUE(iter.ReadInt64(&time_internal)); | 99 EXPECT_TRUE(iter.ReadInt64(&time_internal)); |
| 100 int msgid; | 100 int msgid; |
| 101 EXPECT_TRUE(iter.ReadInt(&msgid)); | 101 EXPECT_TRUE(iter.ReadInt(&msgid)); |
| 102 std::string payload; | 102 std::string payload; |
| 103 EXPECT_TRUE(iter.ReadString(&payload)); | 103 EXPECT_TRUE(iter.ReadString(&payload)); |
| 104 | 104 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 // Call this before running the message loop. | 154 // Call this before running the message loop. |
| 155 void SetTestParams(int msg_count, size_t msg_size) { | 155 void SetTestParams(int msg_count, size_t msg_size) { |
| 156 DCHECK_EQ(0, count_down_); | 156 DCHECK_EQ(0, count_down_); |
| 157 msg_count_ = msg_count; | 157 msg_count_ = msg_count; |
| 158 msg_size_ = msg_size; | 158 msg_size_ = msg_size; |
| 159 count_down_ = msg_count_; | 159 count_down_ = msg_count_; |
| 160 payload_ = std::string(msg_size_, 'a'); | 160 payload_ = std::string(msg_size_, 'a'); |
| 161 } | 161 } |
| 162 | 162 |
| 163 virtual bool OnMessageReceived(const Message& message) OVERRIDE { | 163 virtual bool OnMessageReceived(const Message& message) override { |
| 164 CHECK(sender_); | 164 CHECK(sender_); |
| 165 | 165 |
| 166 PickleIterator iter(message); | 166 PickleIterator iter(message); |
| 167 int64 time_internal; | 167 int64 time_internal; |
| 168 EXPECT_TRUE(iter.ReadInt64(&time_internal)); | 168 EXPECT_TRUE(iter.ReadInt64(&time_internal)); |
| 169 int msgid; | 169 int msgid; |
| 170 EXPECT_TRUE(iter.ReadInt(&msgid)); | 170 EXPECT_TRUE(iter.ReadInt(&msgid)); |
| 171 std::string reflected_payload; | 171 std::string reflected_payload; |
| 172 EXPECT_TRUE(iter.ReadString(&reflected_payload)); | 172 EXPECT_TRUE(iter.ReadString(&reflected_payload)); |
| 173 | 173 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 base::MessageLoop::current()->Run(); | 333 base::MessageLoop::current()->Run(); |
| 334 return 0; | 334 return 0; |
| 335 } | 335 } |
| 336 | 336 |
| 337 scoped_refptr<base::TaskRunner> PingPongTestClient::task_runner() { | 337 scoped_refptr<base::TaskRunner> PingPongTestClient::task_runner() { |
| 338 return main_message_loop_.message_loop_proxy(); | 338 return main_message_loop_.message_loop_proxy(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 } // namespace test | 341 } // namespace test |
| 342 } // namespace IPC | 342 } // namespace IPC |
| OLD | NEW |