| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (num_bytes > kMaxMessageNumBytes) | 59 if (num_bytes > kMaxMessageNumBytes) |
| 60 return MOJO_RESULT_RESOURCE_EXHAUSTED; | 60 return MOJO_RESULT_RESOURCE_EXHAUSTED; |
| 61 | 61 |
| 62 if (transports) | 62 if (transports) |
| 63 return MOJO_RESULT_UNIMPLEMENTED; | 63 return MOJO_RESULT_UNIMPLEMENTED; |
| 64 | 64 |
| 65 return MOJO_RESULT_OK; | 65 return MOJO_RESULT_OK; |
| 66 } | 66 } |
| 67 | 67 |
| 68 virtual MojoResult ReadMessageImplNoLock( | 68 virtual MojoResult ReadMessageImplNoLock( |
| 69 void* bytes, | 69 UserPointer<void> bytes, |
| 70 uint32_t* num_bytes, | 70 UserPointer<uint32_t> num_bytes, |
| 71 DispatcherVector* dispatchers, | 71 DispatcherVector* dispatchers, |
| 72 uint32_t* num_dispatchers, | 72 uint32_t* num_dispatchers, |
| 73 MojoReadMessageFlags /*flags*/) OVERRIDE { | 73 MojoReadMessageFlags /*flags*/) OVERRIDE { |
| 74 info_->IncrementReadMessageCallCount(); | 74 info_->IncrementReadMessageCallCount(); |
| 75 lock().AssertAcquired(); | 75 lock().AssertAcquired(); |
| 76 | 76 |
| 77 if (num_bytes && !VerifyUserPointerWithSize<1>(bytes, *num_bytes)) | |
| 78 return MOJO_RESULT_INVALID_ARGUMENT; | |
| 79 | |
| 80 if (num_dispatchers) { | 77 if (num_dispatchers) { |
| 81 *num_dispatchers = 1; | 78 *num_dispatchers = 1; |
| 82 if (dispatchers) { | 79 if (dispatchers) { |
| 83 // Okay to leave an invalid dispatcher. | 80 // Okay to leave an invalid dispatcher. |
| 84 dispatchers->resize(1); | 81 dispatchers->resize(1); |
| 85 } | 82 } |
| 86 } | 83 } |
| 87 | 84 |
| 88 return MOJO_RESULT_OK; | 85 return MOJO_RESULT_OK; |
| 89 } | 86 } |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 345 } |
| 349 | 346 |
| 350 void CoreTestBase_MockHandleInfo::IncrementCancelAllWaitersCallCount() { | 347 void CoreTestBase_MockHandleInfo::IncrementCancelAllWaitersCallCount() { |
| 351 base::AutoLock locker(lock_); | 348 base::AutoLock locker(lock_); |
| 352 cancel_all_waiters_call_count_++; | 349 cancel_all_waiters_call_count_++; |
| 353 } | 350 } |
| 354 | 351 |
| 355 } // namespace test | 352 } // namespace test |
| 356 } // namespace system | 353 } // namespace system |
| 357 } // namespace mojo | 354 } // namespace mojo |
| OLD | NEW |