OLD | NEW |
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/system/core_test_base.h" | 5 #include "mojo/system/core_test_base.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 virtual MojoResult WriteMessageImplNoLock( | 45 virtual MojoResult WriteMessageImplNoLock( |
46 const void* bytes, | 46 const void* bytes, |
47 uint32_t num_bytes, | 47 uint32_t num_bytes, |
48 const MojoHandle* handles, | 48 const MojoHandle* handles, |
49 uint32_t num_handles, | 49 uint32_t num_handles, |
50 MojoWriteMessageFlags /*flags*/) OVERRIDE { | 50 MojoWriteMessageFlags /*flags*/) OVERRIDE { |
51 info_->IncrementWriteMessageCallCount(); | 51 info_->IncrementWriteMessageCallCount(); |
52 lock().AssertAcquired(); | 52 lock().AssertAcquired(); |
53 | 53 |
54 if (!VerifyUserPointer(bytes, num_bytes, 1)) | 54 if (!VerifyUserPointer<void>(bytes, num_bytes)) |
55 return MOJO_RESULT_INVALID_ARGUMENT; | 55 return MOJO_RESULT_INVALID_ARGUMENT; |
56 if (!VerifyUserPointer(handles, num_handles, sizeof(handles[0]))) | 56 if (!VerifyUserPointer<MojoHandle>(handles, num_handles)) |
57 return MOJO_RESULT_INVALID_ARGUMENT; | 57 return MOJO_RESULT_INVALID_ARGUMENT; |
58 | 58 |
59 return MOJO_RESULT_OK; | 59 return MOJO_RESULT_OK; |
60 } | 60 } |
61 | 61 |
62 virtual MojoResult ReadMessageImplNoLock( | 62 virtual MojoResult ReadMessageImplNoLock( |
63 void* bytes, | 63 void* bytes, |
64 uint32_t* num_bytes, | 64 uint32_t* num_bytes, |
65 MojoHandle* handles, | 65 MojoHandle* handles, |
66 uint32_t* num_handles, | 66 uint32_t* num_handles, |
67 MojoReadMessageFlags /*flags*/) OVERRIDE { | 67 MojoReadMessageFlags /*flags*/) OVERRIDE { |
68 info_->IncrementReadMessageCallCount(); | 68 info_->IncrementReadMessageCallCount(); |
69 lock().AssertAcquired(); | 69 lock().AssertAcquired(); |
70 | 70 |
71 if (num_bytes && !VerifyUserPointer(bytes, *num_bytes, 1)) | 71 if (num_bytes && !VerifyUserPointer<void>(bytes, *num_bytes)) |
72 return MOJO_RESULT_INVALID_ARGUMENT; | 72 return MOJO_RESULT_INVALID_ARGUMENT; |
73 if (num_handles && | 73 if (num_handles && |
74 !VerifyUserPointer(handles, *num_handles, sizeof(handles[0]))) | 74 !VerifyUserPointer<MojoHandle>(handles, *num_handles)) |
75 return MOJO_RESULT_INVALID_ARGUMENT; | 75 return MOJO_RESULT_INVALID_ARGUMENT; |
76 | 76 |
77 return MOJO_RESULT_OK; | 77 return MOJO_RESULT_OK; |
78 } | 78 } |
79 | 79 |
80 virtual MojoResult AddWaiterImplNoLock(Waiter* /*waiter*/, | 80 virtual MojoResult AddWaiterImplNoLock(Waiter* /*waiter*/, |
81 MojoWaitFlags /*flags*/, | 81 MojoWaitFlags /*flags*/, |
82 MojoResult /*wake_result*/) OVERRIDE { | 82 MojoResult /*wake_result*/) OVERRIDE { |
83 info_->IncrementAddWaiterCallCount(); | 83 info_->IncrementAddWaiterCallCount(); |
84 lock().AssertAcquired(); | 84 lock().AssertAcquired(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 218 } |
219 | 219 |
220 void CoreTestBase_MockHandleInfo::IncrementCancelAllWaitersCallCount() { | 220 void CoreTestBase_MockHandleInfo::IncrementCancelAllWaitersCallCount() { |
221 base::AutoLock locker(lock_); | 221 base::AutoLock locker(lock_); |
222 cancel_all_waiters_call_count_++; | 222 cancel_all_waiters_call_count_++; |
223 } | 223 } |
224 | 224 |
225 } // namespace test | 225 } // namespace test |
226 } // namespace system | 226 } // namespace system |
227 } // namespace mojo | 227 } // namespace mojo |
OLD | NEW |