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

Side by Side Diff: ipc/ipc_perftest_support.cc

Issue 666493005: Standardize usage of virtual/override/final in ipc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « ipc/ipc_message_macros.h ('k') | ipc/ipc_send_fds_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // message. It assumes each message has one string parameter. When the string 74 // message. It assumes each message has one string parameter. When the string
75 // "quit" is sent, it will exit. 75 // "quit" is sent, it will exit.
76 class ChannelReflectorListener : public Listener { 76 class ChannelReflectorListener : public Listener {
77 public: 77 public:
78 ChannelReflectorListener() 78 ChannelReflectorListener()
79 : channel_(NULL), 79 : channel_(NULL),
80 latency_tracker_("Client messages") { 80 latency_tracker_("Client messages") {
81 VLOG(1) << "Client listener up"; 81 VLOG(1) << "Client listener up";
82 } 82 }
83 83
84 virtual ~ChannelReflectorListener() { 84 ~ChannelReflectorListener() override {
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 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 30 matching lines...) Expand all
135 explicit PerformanceChannelListener(const std::string& label) 135 explicit PerformanceChannelListener(const std::string& label)
136 : label_(label), 136 : label_(label),
137 sender_(NULL), 137 sender_(NULL),
138 msg_count_(0), 138 msg_count_(0),
139 msg_size_(0), 139 msg_size_(0),
140 count_down_(0), 140 count_down_(0),
141 latency_tracker_("Server messages") { 141 latency_tracker_("Server messages") {
142 VLOG(1) << "Server listener up"; 142 VLOG(1) << "Server listener up";
143 } 143 }
144 144
145 virtual ~PerformanceChannelListener() { 145 ~PerformanceChannelListener() override {
146 VLOG(1) << "Server listener down"; 146 VLOG(1) << "Server listener down";
147 } 147 }
148 148
149 void Init(Sender* sender) { 149 void Init(Sender* sender) {
150 DCHECK(!sender_); 150 DCHECK(!sender_);
151 sender_ = sender; 151 sender_ = sender;
152 } 152 }
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 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
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
OLDNEW
« no previous file with comments | « ipc/ipc_message_macros.h ('k') | ipc/ipc_send_fds_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698