| 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 #ifndef MOJO_EDK_SYSTEM_MEMORY_H_ | 5 #ifndef MOJO_EDK_SYSTEM_MEMORY_H_ |
| 6 #define MOJO_EDK_SYSTEM_MEMORY_H_ | 6 #define MOJO_EDK_SYSTEM_MEMORY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <string.h> // For |memcpy()|. | 10 #include <string.h> // For |memcpy()|. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 // Checks (insofar as appropriate/possible) that |pointer| is a valid pointer to | 47 // Checks (insofar as appropriate/possible) that |pointer| is a valid pointer to |
| 48 // a buffer of the given size and alignment (both in bytes). | 48 // a buffer of the given size and alignment (both in bytes). |
| 49 template <size_t size, size_t alignment> | 49 template <size_t size, size_t alignment> |
| 50 void MOJO_SYSTEM_IMPL_EXPORT CheckUserPointer(const void* pointer); | 50 void MOJO_SYSTEM_IMPL_EXPORT CheckUserPointer(const void* pointer); |
| 51 | 51 |
| 52 // Checks (insofar as appropriate/possible) that |pointer| is a valid pointer to | 52 // Checks (insofar as appropriate/possible) that |pointer| is a valid pointer to |
| 53 // a buffer of |count| elements of the given size and alignment (both in bytes). | 53 // a buffer of |count| elements of the given size and alignment (both in bytes). |
| 54 template <size_t size, size_t alignment> | 54 template <size_t size, size_t alignment> |
| 55 void MOJO_SYSTEM_IMPL_EXPORT | 55 void MOJO_SYSTEM_IMPL_EXPORT |
| 56 CheckUserPointerWithCount(const void* pointer, size_t count); | 56 CheckUserPointerWithCount(const void* pointer, size_t count); |
| 57 | 57 |
| 58 // Checks (insofar as appropriate/possible) that |pointer| is a valid pointer to | 58 // Checks (insofar as appropriate/possible) that |pointer| is a valid pointer to |
| 59 // a buffer of the given size and alignment (both in bytes). | 59 // a buffer of the given size and alignment (both in bytes). |
| 60 template <size_t alignment> | 60 template <size_t alignment> |
| 61 void MOJO_SYSTEM_IMPL_EXPORT | 61 void MOJO_SYSTEM_IMPL_EXPORT |
| 62 CheckUserPointerWithSize(const void* pointer, size_t size); | 62 CheckUserPointerWithSize(const void* pointer, size_t size); |
| 63 | 63 |
| 64 } // namespace internal | 64 } // namespace internal |
| 65 | 65 |
| 66 // Forward declarations so that they can be friended. | 66 // Forward declarations so that they can be friended. |
| 67 template <typename Type> | 67 template <typename Type> |
| 68 class UserPointerReader; | 68 class UserPointerReader; |
| 69 template <typename Type> | 69 template <typename Type> |
| 70 class UserPointerWriter; | 70 class UserPointerWriter; |
| 71 template <typename Type> | 71 template <typename Type> |
| 72 class UserPointerReaderWriter; | 72 class UserPointerReaderWriter; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 size_t count_; | 368 size_t count_; |
| 369 scoped_ptr<Type[]> buffer_; | 369 scoped_ptr<Type[]> buffer_; |
| 370 | 370 |
| 371 DISALLOW_COPY_AND_ASSIGN(UserPointerReaderWriter); | 371 DISALLOW_COPY_AND_ASSIGN(UserPointerReaderWriter); |
| 372 }; | 372 }; |
| 373 | 373 |
| 374 } // namespace system | 374 } // namespace system |
| 375 } // namespace mojo | 375 } // namespace mojo |
| 376 | 376 |
| 377 #endif // MOJO_EDK_SYSTEM_MEMORY_H_ | 377 #endif // MOJO_EDK_SYSTEM_MEMORY_H_ |
| OLD | NEW |