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

Side by Side Diff: mojo/system/message_pipe_perftest.cc

Issue 597413002: Mojo: NULL -> nullptr in mojo/system and mojo/embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: EXPECT_TRUE Created 6 years, 3 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
« no previous file with comments | « mojo/system/message_pipe_dispatcher_unittest.cc ('k') | mojo/system/message_pipe_test_utils.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include <stdint.h> 5 #include <stdint.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 payload_ = Pickle(); 43 payload_ = Pickle();
44 payload_.WriteString(std::string(message_size, '*')); 44 payload_.WriteString(std::string(message_size, '*'));
45 read_buffer_.resize(message_size * 2); 45 read_buffer_.resize(message_size * 2);
46 } 46 }
47 47
48 protected: 48 protected:
49 void WriteWaitThenRead(scoped_refptr<MessagePipe> mp) { 49 void WriteWaitThenRead(scoped_refptr<MessagePipe> mp) {
50 CHECK_EQ(mp->WriteMessage(0, 50 CHECK_EQ(mp->WriteMessage(0,
51 UserPointer<const void>(payload_.data()), 51 UserPointer<const void>(payload_.data()),
52 static_cast<uint32_t>(payload_.size()), 52 static_cast<uint32_t>(payload_.size()),
53 NULL, 53 nullptr,
54 MOJO_WRITE_MESSAGE_FLAG_NONE), 54 MOJO_WRITE_MESSAGE_FLAG_NONE),
55 MOJO_RESULT_OK); 55 MOJO_RESULT_OK);
56 HandleSignalsState hss; 56 HandleSignalsState hss;
57 CHECK_EQ(test::WaitIfNecessary(mp, MOJO_HANDLE_SIGNAL_READABLE, &hss), 57 CHECK_EQ(test::WaitIfNecessary(mp, MOJO_HANDLE_SIGNAL_READABLE, &hss),
58 MOJO_RESULT_OK); 58 MOJO_RESULT_OK);
59 uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer_.size()); 59 uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer_.size());
60 CHECK_EQ(mp->ReadMessage(0, 60 CHECK_EQ(mp->ReadMessage(0,
61 UserPointer<void>(&read_buffer_[0]), 61 UserPointer<void>(&read_buffer_[0]),
62 MakeUserPointer(&read_buffer_size), 62 MakeUserPointer(&read_buffer_size),
63 NULL, 63 nullptr,
64 NULL, 64 nullptr,
65 MOJO_READ_MESSAGE_FLAG_NONE), 65 MOJO_READ_MESSAGE_FLAG_NONE),
66 MOJO_RESULT_OK); 66 MOJO_RESULT_OK);
67 CHECK_EQ(read_buffer_size, static_cast<uint32_t>(payload_.size())); 67 CHECK_EQ(read_buffer_size, static_cast<uint32_t>(payload_.size()));
68 } 68 }
69 69
70 void SendQuitMessage(scoped_refptr<MessagePipe> mp) { 70 void SendQuitMessage(scoped_refptr<MessagePipe> mp) {
71 CHECK_EQ(mp->WriteMessage(0, 71 CHECK_EQ(mp->WriteMessage(0,
72 UserPointer<const void>(""), 72 UserPointer<const void>(""),
73 0, 73 0,
74 NULL, 74 nullptr,
75 MOJO_WRITE_MESSAGE_FLAG_NONE), 75 MOJO_WRITE_MESSAGE_FLAG_NONE),
76 MOJO_RESULT_OK); 76 MOJO_RESULT_OK);
77 } 77 }
78 78
79 void Measure(scoped_refptr<MessagePipe> mp) { 79 void Measure(scoped_refptr<MessagePipe> mp) {
80 // Have one ping-pong to ensure channel being established. 80 // Have one ping-pong to ensure channel being established.
81 WriteWaitThenRead(mp); 81 WriteWaitThenRead(mp);
82 82
83 std::string test_name = 83 std::string test_name =
84 base::StringPrintf("IPC_Perf_%dx_%u", 84 base::StringPrintf("IPC_Perf_%dx_%u",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 test::WaitIfNecessary(mp, MOJO_HANDLE_SIGNAL_READABLE, &hss); 123 test::WaitIfNecessary(mp, MOJO_HANDLE_SIGNAL_READABLE, &hss);
124 if (result != MOJO_RESULT_OK) { 124 if (result != MOJO_RESULT_OK) {
125 rv = result; 125 rv = result;
126 break; 126 break;
127 } 127 }
128 128
129 uint32_t read_size = static_cast<uint32_t>(buffer.size()); 129 uint32_t read_size = static_cast<uint32_t>(buffer.size());
130 CHECK_EQ(mp->ReadMessage(0, 130 CHECK_EQ(mp->ReadMessage(0,
131 UserPointer<void>(&buffer[0]), 131 UserPointer<void>(&buffer[0]),
132 MakeUserPointer(&read_size), 132 MakeUserPointer(&read_size),
133 NULL, 133 nullptr,
134 NULL, 134 nullptr,
135 MOJO_READ_MESSAGE_FLAG_NONE), 135 MOJO_READ_MESSAGE_FLAG_NONE),
136 MOJO_RESULT_OK); 136 MOJO_RESULT_OK);
137 137
138 // Empty message indicates quitting 138 // Empty message indicates quitting
139 if (0 == read_size) 139 if (0 == read_size)
140 break; 140 break;
141 141
142 CHECK_EQ(mp->WriteMessage(0, 142 CHECK_EQ(mp->WriteMessage(0,
143 UserPointer<const void>(&buffer[0]), 143 UserPointer<const void>(&buffer[0]),
144 static_cast<uint32_t>(read_size), 144 static_cast<uint32_t>(read_size),
145 NULL, 145 nullptr,
146 MOJO_WRITE_MESSAGE_FLAG_NONE), 146 MOJO_WRITE_MESSAGE_FLAG_NONE),
147 MOJO_RESULT_OK); 147 MOJO_RESULT_OK);
148 } 148 }
149 149
150 mp->Close(0); 150 mp->Close(0);
151 return rv; 151 return rv;
152 } 152 }
153 153
154 // Repeatedly sends messages as previous one got replied by the child. 154 // Repeatedly sends messages as previous one got replied by the child.
155 // Waits for the child to close its end before quitting once specified 155 // Waits for the child to close its end before quitting once specified
(...skipping 15 matching lines...) Expand all
171 } 171 }
172 172
173 SendQuitMessage(mp); 173 SendQuitMessage(mp);
174 mp->Close(0); 174 mp->Close(0);
175 EXPECT_EQ(0, helper()->WaitForChildShutdown()); 175 EXPECT_EQ(0, helper()->WaitForChildShutdown());
176 } 176 }
177 177
178 } // namespace 178 } // namespace
179 } // namespace system 179 } // namespace system
180 } // namespace mojo 180 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/message_pipe_dispatcher_unittest.cc ('k') | mojo/system/message_pipe_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698