| Index: sky/engine/tonic/dart_gc_context.cc
|
| diff --git a/sky/engine/tonic/dart_gc_context.cc b/sky/engine/tonic/dart_gc_context.cc
|
| index 9329a56d4156dc1b12ea974df177ec7153cef24a..5d3b79103a0151c0a236d508bb9ebaa26aad5aca 100644
|
| --- a/sky/engine/tonic/dart_gc_context.cc
|
| +++ b/sky/engine/tonic/dart_gc_context.cc
|
| @@ -2,6 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include <utility>
|
| +
|
| #include "sky/engine/tonic/dart_gc_context.h"
|
|
|
| namespace blink {
|
| @@ -15,13 +17,14 @@ DartGCContext::~DartGCContext() {
|
| Dart_WeakReferenceSet DartGCContext::AddToSetForRoot(
|
| const void* root,
|
| Dart_WeakPersistentHandle handle) {
|
| - const auto& it = references_.add(root, nullptr);
|
| - if (!it.isNewEntry) {
|
| - Dart_AppendToWeakReferenceSet(it.storedValue->value, handle, handle);
|
| - return it.storedValue->value;
|
| + const auto& result = references_.insert(std::make_pair(root, nullptr));
|
| + if (!result.second) {
|
| + // Already present.
|
| + Dart_AppendToWeakReferenceSet(result.first->second, handle, handle);
|
| + return result.first->second;
|
| }
|
| - it.storedValue->value = Dart_NewWeakReferenceSet(builder_, handle, handle);
|
| - return it.storedValue->value;
|
| + result.first->second = Dart_NewWeakReferenceSet(builder_, handle, handle);
|
| + return result.first->second;
|
| }
|
|
|
| } // namespace blink
|
|
|