1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef MOJO_EDK_EMBEDDER_CONFIGURATION_H_ 6 #define MOJO_EDK_EMBEDDER_CONFIGURATION_H_ 7 8 #include <stddef.h> 9 #include <stdint.h> 10 11 namespace mojo { 12 namespace edk { 13 14 // A set of constants that the Mojo system internally uses. These values should 15 // be consistent across all processes on the same system. 16 // 17 // In general, there should be no need to change these values from their 18 // defaults. However, if you do change them, you must do so before 19 // initialization. 20 struct Configuration { 21 // Maximum number of open (Mojo) handles. The default is 1,000,000. 22 // 23 // TODO(vtl): This doesn't count "live" handles, some of which may live in 24 // messages. 25 size_t max_handle_table_size; 26 27 // Maximum number of active memory mappings. The default is 1,000,000. 28 size_t max_mapping_table_sze; 29 30 // Upper limit of |MojoWaitMany()|'s |num_handles|. The default is 1,000,000. 31 // Must be same as or smaller than |max_handle_table_size|. 32 size_t max_wait_many_num_handles; 33 34 // Maximum data size of messages sent over message pipes, in bytes. The 35 // default is 4MB. 36 size_t max_message_num_bytes; 37 38 // Maximum number of handles that can be attached to messages sent over 39 // message pipes. The default is 10,000. 40 size_t max_message_num_handles; 41 42 // Maximum capacity of a data pipe, in bytes. The default is 256MB. This value 43 // must fit into a |uint32_t|. WARNING: If you bump it closer to 2^32, you 44 // must audit all the code to check that we don't overflow (2^31 would 45 // definitely be risky; up to 2^30 is probably okay). 46 size_t max_data_pipe_capacity_bytes; 47 48 // Default data pipe capacity, if not specified explicitly in the creation 49 // options. The default is 1MB. 50 size_t default_data_pipe_capacity_bytes; 51 52 // Alignment for the "start" of the data buffer used by data pipes. (The 53 // alignment of elements will depend on this and the element size.) The 54 // default is 16 bytes. 55 size_t data_pipe_buffer_alignment_bytes; 56 57 // Maximum size of a single shared memory segment, in bytes. The default is 58 // 1GB. 59 // 60 // TODO(vtl): Set this hard limit appropriately (e.g., higher on 64-bit). 61 // (This will also entail some auditing to make sure I'm not messing up my 62 // checks anywhere.) 63 size_t max_shared_memory_num_bytes; 64 }; 65 66 } // namespace edk 67 } // namespace mojo 68 69 #endif // MOJO_EDK_EMBEDDER_CONFIGURATION_H_ 70