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

Side by Side Diff: mojo/public/tests/system_core_perftest.cc

Issue 25323003: Mojo: Optimize VerifyUserPointer(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/system/core_impl.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 #include "mojo/public/system/core.h" 5 #include "mojo/public/system/core.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "mojo/public/tests/test_support.h" 10 #include "mojo/public/tests/test_support.h"
(...skipping 27 matching lines...) Expand all
38 MOJO_WRITE_MESSAGE_FLAG_NONE); 38 MOJO_WRITE_MESSAGE_FLAG_NONE);
39 DCHECK_EQ(result, MOJO_RESULT_OK); 39 DCHECK_EQ(result, MOJO_RESULT_OK);
40 uint32_t read_bytes = bytes; 40 uint32_t read_bytes = bytes;
41 result = ReadMessage(h_1_, 41 result = ReadMessage(h_1_,
42 buffer, &read_bytes, 42 buffer, &read_bytes,
43 NULL, NULL, 43 NULL, NULL,
44 MOJO_READ_MESSAGE_FLAG_NONE); 44 MOJO_READ_MESSAGE_FLAG_NONE);
45 DCHECK_EQ(result, MOJO_RESULT_OK); 45 DCHECK_EQ(result, MOJO_RESULT_OK);
46 } 46 }
47 47
48 void MessagePipe_EmptyRead() {
49 MojoResult result;
50 result = ReadMessage(h_0_,
51 NULL, NULL,
52 NULL, NULL,
53 MOJO_READ_MESSAGE_FLAG_MAY_DISCARD);
54 DCHECK_EQ(result, MOJO_RESULT_NOT_FOUND);
55 }
56
48 protected: 57 protected:
49 Handle h_0_; 58 Handle h_0_;
50 Handle h_1_; 59 Handle h_1_;
51 60
52 private: 61 private:
53 DISALLOW_COPY_AND_ASSIGN(SystemPerftest); 62 DISALLOW_COPY_AND_ASSIGN(SystemPerftest);
54 }; 63 };
55 64
56 // A no-op test so we can compare performance. 65 // A no-op test so we can compare performance.
57 TEST_F(SystemPerftest, NoOp) { 66 TEST_F(SystemPerftest, NoOp) {
(...skipping 30 matching lines...) Expand all
88 static_cast<void*>(buffer), static_cast<uint32_t>(1000))); 97 static_cast<void*>(buffer), static_cast<uint32_t>(1000)));
89 test::IterateAndReportPerf( 98 test::IterateAndReportPerf(
90 "MessagePipe_WriteAndRead_10000bytes", 99 "MessagePipe_WriteAndRead_10000bytes",
91 base::Bind(&SystemPerftest::MessagePipe_WriteAndRead, 100 base::Bind(&SystemPerftest::MessagePipe_WriteAndRead,
92 base::Unretained(this), 101 base::Unretained(this),
93 static_cast<void*>(buffer), static_cast<uint32_t>(10000))); 102 static_cast<void*>(buffer), static_cast<uint32_t>(10000)));
94 CHECK_EQ(Close(h_0_), MOJO_RESULT_OK); 103 CHECK_EQ(Close(h_0_), MOJO_RESULT_OK);
95 CHECK_EQ(Close(h_1_), MOJO_RESULT_OK); 104 CHECK_EQ(Close(h_1_), MOJO_RESULT_OK);
96 } 105 }
97 106
107 TEST_F(SystemPerftest, MessagePipe_EmptyRead) {
108 CHECK_EQ(CreateMessagePipe(&h_0_, &h_1_), MOJO_RESULT_OK);
109 test::IterateAndReportPerf(
110 "MessagePipe_EmptyRead",
111 base::Bind(&SystemPerftest::MessagePipe_EmptyRead,
112 base::Unretained(this)));
113 CHECK_EQ(Close(h_0_), MOJO_RESULT_OK);
114 CHECK_EQ(Close(h_1_), MOJO_RESULT_OK);
115 }
116
98 } // namespace 117 } // namespace
99 } // namespace mojo 118 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/system/core_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698