Avi Drissman | dfd88085 | 2022-09-15 20:11:09 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors |
yutak | 4d2f1c7f | 2015-09-16 10:29:36 | [diff] [blame] | 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 TOOLS_BLINK_GC_PLUGIN_BLINK_GC_PLUGIN_OPTIONS_H_ |
| 6 | #define TOOLS_BLINK_GC_PLUGIN_BLINK_GC_PLUGIN_OPTIONS_H_ |
| 7 | |
| 8 | #include <set> |
| 9 | #include <string> |
| 10 | #include <vector> |
| 11 | |
| 12 | struct BlinkGCPluginOptions { |
Daniel Cheng | 2de974ba | 2016-12-20 22:15:13 | [diff] [blame] | 13 | bool dump_graph = false; |
sigbjornf | 59dc1fe | 2017-02-08 18:49:43 | [diff] [blame] | 14 | |
Omer Katz | f155ae1 | 2022-01-05 17:46:39 | [diff] [blame] | 15 | // Persistent<T> fields are not allowed in garbage collected classes to avoid |
| 16 | // memory leaks. Enabling this flag allows the plugin to check also for |
| 17 | // Persistent<T> in types held by unique_ptr in garbage collected classes. The |
| 18 | // guideline for this check is that a Persistent<T> should never be kept alive |
| 19 | // by a garbage collected class, which unique_ptr clearly conveys. |
| 20 | // |
| 21 | // This check is disabled by default since there are currently non-ignored |
| 22 | // violations of this rule in the code base, leading to compilation failures. |
| 23 | // TODO(chromium:1283867): Enable this checks once all violations are handled. |
| 24 | bool enable_persistent_in_unique_ptr_check = false; |
| 25 | |
Omer Katz | ddfccc5 | 2022-01-20 18:08:34 | [diff] [blame] | 26 | // On stack references to garbage collected objects should use raw pointers. |
| 27 | // Although using Members/WeakMembers on stack is not strictly incorrect, it |
| 28 | // is redundant and incurs additional costs that can mount up and become |
| 29 | // significant. Enabling this flag lets the plugin to check for instances of |
| 30 | // using Member/WeakMember on stack. These would include variable |
| 31 | // declarations, method arguments and return types. |
| 32 | // |
| 33 | // This check is disabled by default since there currently are violations |
| 34 | // of this rule in the code base, leading to compilation failures. |
| 35 | // TODO(chromium:1283720): Enable this checks once all violations are handled. |
| 36 | bool enable_members_on_stack_check = false; |
| 37 | |
Anton Bikineev | c35a8cf06 | 2022-09-30 08:45:48 | [diff] [blame] | 38 | // Checks that any inlined classes (ones that could be a value-type of heap |
| 39 | // containers) don't have extra padding potentially introduced by Member (e.g |
| 40 | // due to pointer compression). |
| 41 | bool enable_extra_padding_check = false; |
| 42 | |
Omer Katz | 264e35b | 2023-08-09 08:56:46 | [diff] [blame] | 43 | // Enables checks for GCed objects, Members, and pointers or references to |
Omer Katz | 9f8c356 | 2024-04-09 06:53:02 | [diff] [blame] | 44 | // GCed objects and in stl and WTF collections. Do not remove this flag. It is |
| 45 | // needed for disabling the check for Pdfium builds. |
Omer Katz | 4d2615f | 2023-12-22 08:29:46 | [diff] [blame] | 46 | bool enable_off_heap_collections_of_gced_check = true; |
Omer Katz | 264e35b | 2023-08-09 08:56:46 | [diff] [blame] | 47 | |
[email protected] | e60ca5cb0 | 2023-12-05 21:47:15 | [diff] [blame] | 48 | std::set<std::string> ignored_classes; |
| 49 | std::set<std::string> checked_namespaces; |
| 50 | std::vector<std::string> checked_directories; |
| 51 | std::vector<std::string> ignored_directories; |
yutak | 4d2f1c7f | 2015-09-16 10:29:36 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | #endif // TOOLS_BLINK_GC_PLUGIN_BLINK_GC_PLUGIN_OPTIONS_H_ |