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

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

Issue 304303006: Mojo: Specify/check alignment of pointers more carefully. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix msvs Created 6 years, 6 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 | « mojo/system/core.cc ('k') | mojo/system/data_pipe_consumer_dispatcher.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/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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 virtual MojoResult WriteMessageImplNoLock( 49 virtual MojoResult WriteMessageImplNoLock(
50 const void* bytes, 50 const void* bytes,
51 uint32_t num_bytes, 51 uint32_t num_bytes,
52 std::vector<DispatcherTransport>* transports, 52 std::vector<DispatcherTransport>* transports,
53 MojoWriteMessageFlags /*flags*/) OVERRIDE { 53 MojoWriteMessageFlags /*flags*/) OVERRIDE {
54 info_->IncrementWriteMessageCallCount(); 54 info_->IncrementWriteMessageCallCount();
55 lock().AssertAcquired(); 55 lock().AssertAcquired();
56 56
57 if (!VerifyUserPointer<void>(bytes, num_bytes)) 57 if (!VerifyUserPointerWithSize<1>(bytes, num_bytes))
58 return MOJO_RESULT_INVALID_ARGUMENT; 58 return MOJO_RESULT_INVALID_ARGUMENT;
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 void* bytes,
70 uint32_t* num_bytes, 70 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 && !VerifyUserPointer<void>(bytes, *num_bytes)) 77 if (num_bytes && !VerifyUserPointerWithSize<1>(bytes, *num_bytes))
78 return MOJO_RESULT_INVALID_ARGUMENT; 78 return MOJO_RESULT_INVALID_ARGUMENT;
79 79
80 return MOJO_RESULT_OK; 80 return MOJO_RESULT_OK;
81 } 81 }
82 82
83 virtual MojoResult WriteDataImplNoLock( 83 virtual MojoResult WriteDataImplNoLock(
84 const void* /*elements*/, 84 const void* /*elements*/,
85 uint32_t* /*num_bytes*/, 85 uint32_t* /*num_bytes*/,
86 MojoWriteDataFlags /*flags*/) OVERRIDE { 86 MojoWriteDataFlags /*flags*/) OVERRIDE {
87 info_->IncrementWriteDataCallCount(); 87 info_->IncrementWriteDataCallCount();
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 340 }
341 341
342 void CoreTestBase_MockHandleInfo::IncrementCancelAllWaitersCallCount() { 342 void CoreTestBase_MockHandleInfo::IncrementCancelAllWaitersCallCount() {
343 base::AutoLock locker(lock_); 343 base::AutoLock locker(lock_);
344 cancel_all_waiters_call_count_++; 344 cancel_all_waiters_call_count_++;
345 } 345 }
346 346
347 } // namespace test 347 } // namespace test
348 } // namespace system 348 } // namespace system
349 } // namespace mojo 349 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/core.cc ('k') | mojo/system/data_pipe_consumer_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698