1 // Copyright 2015 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 TOOLS_BLINK_GC_PLUGIN_CHECK_GC_ROOTS_VISITOR_H_ 6 #define TOOLS_BLINK_GC_PLUGIN_CHECK_GC_ROOTS_VISITOR_H_ 7 8 #include <set> 9 #include <vector> 10 11 #include "Edge.h" 12 #include "RecordInfo.h" 13 14 // This visitor checks that the fields of a class and the fields of 15 // its part objects don't define GC roots. 16 class CheckGCRootsVisitor : public RecursiveEdgeVisitor { 17 public: 18 typedef std::vector<FieldPoint*> RootPath; 19 typedef std::set<RecordInfo*> VisitingSet; 20 typedef std::vector<RootPath> Errors; 21 22 CheckGCRootsVisitor(); 23 24 Errors& gc_roots(); 25 26 bool ContainsGCRoots(RecordInfo* info); 27 28 void VisitValue(Value* edge) override; 29 void VisitPersistent(Persistent* edge) override; 30 void AtCollection(Collection* edge) override; 31 32 private: 33 RootPath current_; 34 VisitingSet visiting_set_; 35 Errors gc_roots_; 36 }; 37 38 #endif // TOOLS_BLINK_GC_PLUGIN_CHECK_GC_ROOTS_VISITOR_H_ 39