Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp

Issue 2902563002: blink_gc_plugin: disallow WeakMember<> fields in off-heap objects. (Closed)
Patch Set: add missing file from ps#3 Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp
diff --git a/tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp b/tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp
index 05419da6d67eb71958ecd944bf247bfe3803fee9..735ec0e8858a4d45da5feda4799da14b63d3e889 100644
--- a/tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp
+++ b/tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp
@@ -6,13 +6,10 @@
#include <cassert>
-#include "BlinkGCPluginOptions.h"
#include "RecordInfo.h"
-CheckFieldsVisitor::CheckFieldsVisitor()
- : current_(0),
- stack_allocated_host_(false) {
-}
+CheckFieldsVisitor::CheckFieldsVisitor(const BlinkGCPluginOptions& options)
+ : options_(options), current_(0), stack_allocated_host_(false) {}
CheckFieldsVisitor::Errors& CheckFieldsVisitor::invalid_fields() {
return invalid_fields_;
@@ -34,7 +31,7 @@ bool CheckFieldsVisitor::ContainsInvalidFields(RecordInfo* info) {
return !invalid_fields_.empty();
}
-void CheckFieldsVisitor::AtMember(Member* edge) {
+void CheckFieldsVisitor::AtMember(Member*) {
if (managed_host_)
return;
// A member is allowed to appear in the context of a root.
@@ -47,6 +44,14 @@ void CheckFieldsVisitor::AtMember(Member* edge) {
invalid_fields_.push_back(std::make_pair(current_, kMemberInUnmanaged));
}
+void CheckFieldsVisitor::AtWeakMember(WeakMember*) {
+ // TODO(sof): remove this once crbug.com/724418's change
+ // has safely been rolled out.
+ if (options_.enable_weak_members_in_unmanaged_classes)
+ return;
+ AtMember(nullptr);
+}
+
void CheckFieldsVisitor::AtIterator(Iterator* edge) {
if (!managed_host_)
return;
« no previous file with comments | « tools/clang/blink_gc_plugin/CheckFieldsVisitor.h ('k') | tools/clang/blink_gc_plugin/tests/member_in_offheap_class.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698