| 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 "sky/engine/config.h" | |
| 6 #include "sky/engine/tonic/dart_gc_context.h" | 5 #include "sky/engine/tonic/dart_gc_context.h" |
| 7 | 6 |
| 8 namespace blink { | 7 namespace blink { |
| 9 | 8 |
| 10 DartGCContext::DartGCContext() : builder_(Dart_NewWeakReferenceSetBuilder()) { | 9 DartGCContext::DartGCContext() : builder_(Dart_NewWeakReferenceSetBuilder()) { |
| 11 } | 10 } |
| 12 | 11 |
| 13 DartGCContext::~DartGCContext() { | 12 DartGCContext::~DartGCContext() { |
| 14 } | 13 } |
| 15 | 14 |
| 16 Dart_WeakReferenceSet DartGCContext::AddToSetForRoot( | 15 Dart_WeakReferenceSet DartGCContext::AddToSetForRoot( |
| 17 const void* root, | 16 const void* root, |
| 18 Dart_WeakPersistentHandle handle) { | 17 Dart_WeakPersistentHandle handle) { |
| 19 const auto& it = references_.add(root, nullptr); | 18 const auto& it = references_.add(root, nullptr); |
| 20 if (!it.isNewEntry) { | 19 if (!it.isNewEntry) { |
| 21 Dart_AppendToWeakReferenceSet(it.storedValue->value, handle, handle); | 20 Dart_AppendToWeakReferenceSet(it.storedValue->value, handle, handle); |
| 22 return it.storedValue->value; | 21 return it.storedValue->value; |
| 23 } | 22 } |
| 24 it.storedValue->value = Dart_NewWeakReferenceSet(builder_, handle, handle); | 23 it.storedValue->value = Dart_NewWeakReferenceSet(builder_, handle, handle); |
| 25 return it.storedValue->value; | 24 return it.storedValue->value; |
| 26 } | 25 } |
| 27 | 26 |
| 28 } // namespace blink | 27 } // namespace blink |
| OLD | NEW |