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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 197963002: Remove the ability to allow multiple gc prologue and gc epilogue callbacks (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 33596)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -768,14 +768,14 @@
Dart_GcPrologueCallback callback) {
Isolate* isolate = Isolate::Current();
CHECK_ISOLATE(isolate);
- GcPrologueCallbacks& callbacks = isolate->gc_prologue_callbacks();
- if (callbacks.Contains(callback)) {
+ if (isolate->gc_prologue_callback() != NULL) {
return Api::NewError(
- "%s permits only one instance of 'callback' to be present in the "
- "prologue callback list.",
+ "%s permits only one gc prologue callback to be registered, please "
+ "remove the existing callback using Dart_RemoveGcPrologueCallback "
+ "and then add this callback",
CURRENT_FUNC);
}
- callbacks.Add(callback);
+ isolate->set_gc_prologue_callback(callback);
return Api::Success();
}
@@ -784,13 +784,13 @@
Dart_GcPrologueCallback callback) {
Isolate* isolate = Isolate::Current();
CHECK_ISOLATE(isolate);
- GcPrologueCallbacks& callbacks = isolate->gc_prologue_callbacks();
- if (!callbacks.Contains(callback)) {
+ if (isolate->gc_prologue_callback() != callback) {
return Api::NewError(
- "%s expects 'callback' to be present in the prologue callback list.",
+ "%s expects 'callback' to be the currently registered gc prologue "
+ "callback .",
CURRENT_FUNC);
}
- callbacks.Remove(callback);
+ isolate->set_gc_prologue_callback(NULL);
return Api::Success();
}
@@ -799,14 +799,14 @@
Dart_GcEpilogueCallback callback) {
Isolate* isolate = Isolate::Current();
CHECK_ISOLATE(isolate);
- GcEpilogueCallbacks& callbacks = isolate->gc_epilogue_callbacks();
- if (callbacks.Contains(callback)) {
+ if (isolate->gc_epilogue_callback() != NULL) {
return Api::NewError(
- "%s permits only one instance of 'callback' to be present in the "
- "epilogue callback list.",
+ "%s permits only one gc epilogue callback to be registered, please "
+ "remove the existing callback using Dart_RemoveGcEpilogueCallback "
+ "and then add this callback",
CURRENT_FUNC);
}
- callbacks.Add(callback);
+ isolate->set_gc_epilogue_callback(callback);
return Api::Success();
}
@@ -815,13 +815,12 @@
Dart_GcEpilogueCallback callback) {
Isolate* isolate = Isolate::Current();
CHECK_ISOLATE(isolate);
- GcEpilogueCallbacks& callbacks = isolate->gc_epilogue_callbacks();
- if (!callbacks.Contains(callback)) {
+ if (isolate->gc_epilogue_callback() != callback) {
return Api::NewError(
"%s expects 'callback' to be present in the epilogue callback list.",
Ivan Posva 2014/03/12 21:06:41 Still referencing list.
siva 2014/03/12 22:38:54 Done.
CURRENT_FUNC);
}
- callbacks.Remove(callback);
+ isolate->set_gc_epilogue_callback(NULL);
return Api::Success();
}
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698