| 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_SYSTEM_CONSTANTS_H_ | 5 #ifndef MOJO_SYSTEM_CONSTANTS_H_ |
| 6 #define MOJO_SYSTEM_CONSTANTS_H_ | 6 #define MOJO_SYSTEM_CONSTANTS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| 11 namespace system { | 11 namespace system { |
| 12 | 12 |
| 13 // Maximum of open (Mojo) handles. | 13 // Maximum number of open (Mojo) handles. |
| 14 // TODO(vtl): This doesn't count "live" handles, some of which may live in | 14 // TODO(vtl): This doesn't count "live" handles, some of which may live in |
| 15 // messages. | 15 // messages. |
| 16 const size_t kMaxHandleTableSize = 1000000; | 16 const size_t kMaxHandleTableSize = 1000000; |
| 17 | 17 |
| 18 // Maximum number of active memory mappings. |
| 19 const size_t kMaxMappingTableSize = 1000000; |
| 20 |
| 18 const size_t kMaxWaitManyNumHandles = kMaxHandleTableSize; | 21 const size_t kMaxWaitManyNumHandles = kMaxHandleTableSize; |
| 19 | 22 |
| 20 const size_t kMaxMessageNumBytes = 4 * 1024 * 1024; | 23 const size_t kMaxMessageNumBytes = 4 * 1024 * 1024; |
| 21 | 24 |
| 22 const size_t kMaxMessageNumHandles = 10000; | 25 const size_t kMaxMessageNumHandles = 10000; |
| 23 | 26 |
| 24 // Maximum capacity of a data pipe, in bytes. This value must fit into a | 27 // Maximum capacity of a data pipe, in bytes. This value must fit into a |
| 25 // |uint32_t|. | 28 // |uint32_t|. |
| 26 // WARNING: If you bump it closer to 2^32, you must audit all the code to check | 29 // WARNING: If you bump it closer to 2^32, you must audit all the code to check |
| 27 // that we don't overflow (2^31 would definitely be risky; up to 2^30 is | 30 // that we don't overflow (2^31 would definitely be risky; up to 2^30 is |
| 28 // probably okay). | 31 // probably okay). |
| 29 const size_t kMaxDataPipeCapacityBytes = 256 * 1024 * 1024; // 256 MB. | 32 const size_t kMaxDataPipeCapacityBytes = 256 * 1024 * 1024; // 256 MB. |
| 30 | 33 |
| 31 const size_t kDefaultDataPipeCapacityBytes = 1024 * 1024; // 1 MB. | 34 const size_t kDefaultDataPipeCapacityBytes = 1024 * 1024; // 1 MB. |
| 32 | 35 |
| 33 // Alignment for the "start" of the data buffer used by data pipes. (The | 36 // Alignment for the "start" of the data buffer used by data pipes. (The |
| 34 // alignment of elements will depend on this and the element size.) | 37 // alignment of elements will depend on this and the element size.) |
| 35 const size_t kDataPipeBufferAlignmentBytes = 16; | 38 const size_t kDataPipeBufferAlignmentBytes = 16; |
| 36 | 39 |
| 37 // TODO(vtl): Set this hard limit appropriately (e.g., higher on 64-bit). (This | 40 // TODO(vtl): Set this hard limit appropriately (e.g., higher on 64-bit). (This |
| 38 // will also entail some auditing to make sure I'm not messing up my checks | 41 // will also entail some auditing to make sure I'm not messing up my checks |
| 39 // anywhere.) | 42 // anywhere.) |
| 40 const size_t kMaxSharedMemoryNumBytes = 1024 * 1024 * 1024; // 1 GB. | 43 const size_t kMaxSharedMemoryNumBytes = 1024 * 1024 * 1024; // 1 GB. |
| 41 | 44 |
| 42 } // namespace system | 45 } // namespace system |
| 43 } // namespace mojo | 46 } // namespace mojo |
| 44 | 47 |
| 45 #endif // MOJO_SYSTEM_CONSTANTS_H_ | 48 #endif // MOJO_SYSTEM_CONSTANTS_H_ |
| OLD | NEW |