CheckGCRootsVisitor.h 993 B

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