blob: 0e94b7c6f8633b672a7fb9ee6f7a2860a43020d4 [file] [log] [blame]
Avi Drissmandfd880852022-09-15 20:11:091// Copyright 2015 The Chromium Authors
yutak4d2f1c7f2015-09-16 10:29:362// 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
12struct BlinkGCPluginOptions {
Daniel Cheng2de974ba2016-12-20 22:15:1313 bool dump_graph = false;
sigbjornf59dc1fe2017-02-08 18:49:4314
Omer Katzf155ae12022-01-05 17:46:3915 // 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 Katzddfccc52022-01-20 18:08:3426 // 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 Bikineevc35a8cf062022-09-30 08:45:4838 // 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 Katz264e35b2023-08-09 08:56:4643 // Enables checks for GCed objects, Members, and pointers or references to
Omer Katz9f8c3562024-04-09 06:53:0244 // 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 Katz4d2615f2023-12-22 08:29:4646 bool enable_off_heap_collections_of_gced_check = true;
Omer Katz264e35b2023-08-09 08:56:4647
[email protected]e60ca5cb02023-12-05 21:47:1548 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;
yutak4d2f1c7f2015-09-16 10:29:3652};
53
54#endif // TOOLS_BLINK_GC_PLUGIN_BLINK_GC_PLUGIN_OPTIONS_H_