| OLD | NEW |
| 1 # GN Style Guide | 1 # GN Style Guide |
| 2 | 2 |
| 3 [TOC] | 3 [TOC] |
| 4 ## Naming and ordering within the file | 4 ## Naming and ordering within the file |
| 5 | 5 |
| 6 ### Location of build files | 6 ### Location of build files |
| 7 | 7 |
| 8 It usually makes sense to have more build files closer to the code than | 8 It usually makes sense to have more build files closer to the code than |
| 9 fewer ones at the toplevel (this is in contrast with what we did with | 9 fewer ones at the toplevel (this is in contrast with what we did with |
| 10 GYP). This makes things easier to find and owners reviews easier since | 10 GYP). This makes things easier to find and owners reviews easier since |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 means the tests will get stripped. | 176 means the tests will get stripped. |
| 177 | 177 |
| 178 * Static libraries involve duplicating all of the data in the object files | 178 * Static libraries involve duplicating all of the data in the object files |
| 179 that comprise it. This takes more disk space and for certain very large | 179 that comprise it. This takes more disk space and for certain very large |
| 180 libraries in configurations with very large object files can cause | 180 libraries in configurations with very large object files can cause |
| 181 internal limits on the size of static libraries to be exceeded. Source | 181 internal limits on the size of static libraries to be exceeded. Source |
| 182 sets do not have this limitation. Some targets switch between source sets | 182 sets do not have this limitation. Some targets switch between source sets |
| 183 and static libraries depending on the build configuration to avoid this | 183 and static libraries depending on the build configuration to avoid this |
| 184 problem. | 184 problem. |
| 185 | 185 |
| 186 * Source sets can have no sources, while static libraries will give strange |
| 187 platform-specific errors if they have no sources. If a target has only |
| 188 headers (for include checking purposes) or conditionally has no sources on |
| 189 sone platforms, use a source set. |
| 190 |
| 186 * In cases where a lot of the symbols are not needed for a particular link | 191 * In cases where a lot of the symbols are not needed for a particular link |
| 187 (this especially happens when linking test binaries), putting that code in | 192 (this especially happens when linking test binaries), putting that code in |
| 188 a static library can dramatically increase linking performance. This is | 193 a static library can dramatically increase linking performance. This is |
| 189 because the object files not needed for the link are never considered in | 194 because the object files not needed for the link are never considered in |
| 190 the first place, rather than forcing the linker to strip the unused code | 195 the first place, rather than forcing the linker to strip the unused code |
| 191 in a later pass when nothing references it. | 196 in a later pass when nothing references it. |
| 192 | 197 |
| 193 ### Loadable modules versus shared libraries versus components | 198 ### Loadable modules versus shared libraries versus components |
| 194 | 199 |
| 195 A component is a Chrome primitive (rather than a built-in GN concept) that | 200 A component is a Chrome primitive (rather than a built-in GN concept) that |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 `enable_google_now`, `enable_nacl`, `enable_remoting`, `enable_pdf`) | 275 `enable_google_now`, `enable_nacl`, `enable_remoting`, `enable_pdf`) |
| 271 | 276 |
| 272 `disable_foo` - _NOT_ recommended, use `enable_foo` instead with swapped default | 277 `disable_foo` - _NOT_ recommended, use `enable_foo` instead with swapped default |
| 273 value | 278 value |
| 274 | 279 |
| 275 `is_foo` - usually a global state descriptor (e.g. `is_chrome_branded`, | 280 `is_foo` - usually a global state descriptor (e.g. `is_chrome_branded`, |
| 276 `is_desktop_linux`); poor choice for non-globals | 281 `is_desktop_linux`); poor choice for non-globals |
| 277 | 282 |
| 278 `foo_use_bar` - prefixes can be used to indicate a limited scope for an argument | 283 `foo_use_bar` - prefixes can be used to indicate a limited scope for an argument |
| 279 (e.g. `rtc_use_h264`, `v8_use_snapshot`) | 284 (e.g. `rtc_use_h264`, `v8_use_snapshot`) |
| OLD | NEW |