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

Side by Side Diff: mojo/public/c/system/tests/core_perftest.cc

Issue 830593003: Update mojo sdk to rev 9fbbc4f0fef1187312316c0ed992342474e139f1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cherry-pick mojo 9d3b8dd17f12d20035a14737fdc38dd926890ff8 Created 5 years, 11 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/public/c/system/functions.h ('k') | mojo/public/c/system/tests/core_unittest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // This tests the performance of the C API. 5 // This tests the performance of the C API.
6 6
7 #include "mojo/public/c/system/core.h" 7 #include "mojo/public/c/system/core.h"
8 8
9 #include <assert.h> 9 #include <assert.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 for (;;) { 75 for (;;) {
76 uint32_t num_bytes = static_cast<uint32_t>(sizeof(buffer)); 76 uint32_t num_bytes = static_cast<uint32_t>(sizeof(buffer));
77 MojoResult result = MojoReadMessage( 77 MojoResult result = MojoReadMessage(
78 handle_, buffer, &num_bytes, NULL, NULL, MOJO_READ_MESSAGE_FLAG_NONE); 78 handle_, buffer, &num_bytes, NULL, NULL, MOJO_READ_MESSAGE_FLAG_NONE);
79 if (result == MOJO_RESULT_OK) { 79 if (result == MOJO_RESULT_OK) {
80 num_reads_++; 80 num_reads_++;
81 continue; 81 continue;
82 } 82 }
83 83
84 if (result == MOJO_RESULT_SHOULD_WAIT) { 84 if (result == MOJO_RESULT_SHOULD_WAIT) {
85 result = MojoWait( 85 result = MojoWait(handle_, MOJO_HANDLE_SIGNAL_READABLE,
86 handle_, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE); 86 MOJO_DEADLINE_INDEFINITE, nullptr);
87 if (result == MOJO_RESULT_OK) { 87 if (result == MOJO_RESULT_OK) {
88 // Go to the top of the loop to read again. 88 // Go to the top of the loop to read again.
89 continue; 89 continue;
90 } 90 }
91 } 91 }
92 92
93 // We failed to read and possibly failed to wait. 93 // We failed to read and possibly failed to wait.
94 // Either |handle_| or its peer was closed. 94 // Either |handle_| or its peer was closed.
95 assert(result == MOJO_RESULT_INVALID_ARGUMENT || 95 assert(result == MOJO_RESULT_INVALID_ARGUMENT ||
96 result == MOJO_RESULT_FAILED_PRECONDITION); 96 result == MOJO_RESULT_FAILED_PRECONDITION);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 DoMessagePipeThreadedTest(1u, 1u, 10000u); 316 DoMessagePipeThreadedTest(1u, 1u, 10000u);
317 317
318 DoMessagePipeThreadedTest(3u, 3u, 10u); 318 DoMessagePipeThreadedTest(3u, 3u, 10u);
319 // 100 was done above. 319 // 100 was done above.
320 DoMessagePipeThreadedTest(3u, 3u, 1000u); 320 DoMessagePipeThreadedTest(3u, 3u, 1000u);
321 DoMessagePipeThreadedTest(3u, 3u, 10000u); 321 DoMessagePipeThreadedTest(3u, 3u, 10000u);
322 } 322 }
323 #endif // !defined(WIN32) 323 #endif // !defined(WIN32)
324 324
325 } // namespace 325 } // namespace
OLDNEW
« no previous file with comments | « mojo/public/c/system/functions.h ('k') | mojo/public/c/system/tests/core_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698