| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef TOOLS_BLINK_GC_PLUGIN_CHECK_FIELDS_VISITOR_H_ | 5 #ifndef TOOLS_BLINK_GC_PLUGIN_CHECK_FIELDS_VISITOR_H_ |
| 6 #define TOOLS_BLINK_GC_PLUGIN_CHECK_FIELDS_VISITOR_H_ | 6 #define TOOLS_BLINK_GC_PLUGIN_CHECK_FIELDS_VISITOR_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "Edge.h" | 10 #include "Edge.h" |
| 11 | 11 |
| 12 struct BlinkGCPluginOptions; | 12 struct BlinkGCPluginOptions; |
| 13 class FieldPoint; | 13 class FieldPoint; |
| 14 | 14 |
| 15 // This visitor checks that the fields of a class are "well formed". | 15 // This visitor checks that the fields of a class are "well formed". |
| 16 // - OwnPtr, RefPtr and RawPtr must not point to a GC derived types. | 16 // - OwnPtr and RefPtr must not point to a GC derived type. |
| 17 // - Part objects must not be GC derived types. | 17 // - Part objects must not be a GC derived type. |
| 18 // - An on-heap class must never contain GC roots. | 18 // - An on-heap class must never contain GC roots. |
| 19 // - Only stack-allocated types may point to stack-allocated types. | 19 // - Only stack-allocated types may point to stack-allocated types. |
| 20 | 20 |
| 21 class CheckFieldsVisitor : public RecursiveEdgeVisitor { | 21 class CheckFieldsVisitor : public RecursiveEdgeVisitor { |
| 22 public: | 22 public: |
| 23 enum Error { | 23 enum Error { |
| 24 kRawPtrToGCManaged, | 24 kRawPtrToGCManaged, |
| 25 kRawPtrToGCManagedWarning, | 25 kRawPtrToGCManagedWarning, |
| 26 kRefPtrToGCManaged, | 26 kRefPtrToGCManaged, |
| 27 kReferencePtrToGCManaged, | 27 kReferencePtrToGCManaged, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 53 Error InvalidSmartPtr(Edge* ptr); | 53 Error InvalidSmartPtr(Edge* ptr); |
| 54 | 54 |
| 55 const BlinkGCPluginOptions& options_; | 55 const BlinkGCPluginOptions& options_; |
| 56 FieldPoint* current_; | 56 FieldPoint* current_; |
| 57 bool stack_allocated_host_; | 57 bool stack_allocated_host_; |
| 58 bool managed_host_; | 58 bool managed_host_; |
| 59 Errors invalid_fields_; | 59 Errors invalid_fields_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 #endif // TOOLS_BLINK_GC_PLUGIN_CHECK_FIELDS_VISITOR_H_ | 62 #endif // TOOLS_BLINK_GC_PLUGIN_CHECK_FIELDS_VISITOR_H_ |
| OLD | NEW |