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