| 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 #include "CheckFieldsVisitor.h" | 5 #include "CheckFieldsVisitor.h" |
| 6 | 6 |
| 7 #include <cassert> | 7 #include <cassert> |
| 8 | 8 |
| 9 #include "BlinkGCPluginOptions.h" | 9 #include "BlinkGCPluginOptions.h" |
| 10 #include "RecordInfo.h" | 10 #include "RecordInfo.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 invalid_fields_.push_back(std::make_pair( | 100 invalid_fields_.push_back(std::make_pair( |
| 101 current_, kReferencePtrToGCManagedWarning)); | 101 current_, kReferencePtrToGCManagedWarning)); |
| 102 } else { | 102 } else { |
| 103 invalid_fields_.push_back(std::make_pair( | 103 invalid_fields_.push_back(std::make_pair( |
| 104 current_, kRawPtrToGCManagedWarning)); | 104 current_, kRawPtrToGCManagedWarning)); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 return; | 107 return; |
| 108 } | 108 } |
| 109 | 109 |
| 110 if (Parent()->IsRawPtr() || Parent()->IsRefPtr() || Parent()->IsOwnPtr()) { | 110 if (Parent()->IsRawPtr() || Parent()->IsOwnPtr()) { |
| 111 invalid_fields_.push_back(std::make_pair( | 111 invalid_fields_.push_back(std::make_pair( |
| 112 current_, InvalidSmartPtr(Parent()))); | 112 current_, InvalidSmartPtr(Parent()))); |
| 113 return; | 113 return; |
| 114 } |
| 115 |
| 116 if (Parent()->IsRefPtr() && !edge->value()->IsGCRefCounted()) { |
| 117 invalid_fields_.push_back(std::make_pair( |
| 118 current_, InvalidSmartPtr(Parent()))); |
| 119 return; |
| 114 } | 120 } |
| 115 } | 121 } |
| 116 | 122 |
| 117 void CheckFieldsVisitor::AtCollection(Collection* edge) { | 123 void CheckFieldsVisitor::AtCollection(Collection* edge) { |
| 118 if (edge->on_heap() && Parent() && Parent()->IsOwnPtr()) | 124 if (edge->on_heap() && Parent() && Parent()->IsOwnPtr()) |
| 119 invalid_fields_.push_back(std::make_pair(current_, kOwnPtrToGCManaged)); | 125 invalid_fields_.push_back(std::make_pair(current_, kOwnPtrToGCManaged)); |
| 120 } | 126 } |
| 121 | 127 |
| 122 bool CheckFieldsVisitor::IsWarning(Error error) { | 128 bool CheckFieldsVisitor::IsWarning(Error error) { |
| 123 if (error == kRawPtrToGCManagedWarning) | 129 if (error == kRawPtrToGCManagedWarning) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 143 return kReferencePtrToGCManaged; | 149 return kReferencePtrToGCManaged; |
| 144 else | 150 else |
| 145 return kRawPtrToGCManaged; | 151 return kRawPtrToGCManaged; |
| 146 } | 152 } |
| 147 if (ptr->IsRefPtr()) | 153 if (ptr->IsRefPtr()) |
| 148 return kRefPtrToGCManaged; | 154 return kRefPtrToGCManaged; |
| 149 if (ptr->IsOwnPtr()) | 155 if (ptr->IsOwnPtr()) |
| 150 return kOwnPtrToGCManaged; | 156 return kOwnPtrToGCManaged; |
| 151 assert(false && "Unknown smart pointer kind"); | 157 assert(false && "Unknown smart pointer kind"); |
| 152 } | 158 } |
| OLD | NEW |