Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(982)

Unified Diff: tonic/dart_gc_context.cc

Issue 1244493002: Wholesale move sky/engine/tonic to tonic (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tonic/dart_gc_context.h ('k') | tonic/dart_gc_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tonic/dart_gc_context.cc
diff --git a/tonic/dart_gc_context.cc b/tonic/dart_gc_context.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2c53d0cbcbca86d9c1bf47224d1dc8503a724b77
--- /dev/null
+++ b/tonic/dart_gc_context.cc
@@ -0,0 +1,30 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <utility>
+
+#include "tonic/dart_gc_context.h"
+
+namespace blink {
+
+DartGCContext::DartGCContext() : builder_(Dart_NewWeakReferenceSetBuilder()) {
+}
+
+DartGCContext::~DartGCContext() {
+}
+
+Dart_WeakReferenceSet DartGCContext::AddToSetForRoot(
+ const void* root,
+ Dart_WeakPersistentHandle handle) {
+ 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;
+ }
+ result.first->second = Dart_NewWeakReferenceSet(builder_, handle, handle);
+ return result.first->second;
+}
+
+} // namespace blink
« no previous file with comments | « tonic/dart_gc_context.h ('k') | tonic/dart_gc_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698