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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 198103004: Remove Dart_AddGcPrologueCallback and Dart_RemoveGcPrologueCallback from the Dart API. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 757
758 WeakReferenceSet* reference_set = new WeakReferenceSet(keys, num_keys, 758 WeakReferenceSet* reference_set = new WeakReferenceSet(keys, num_keys,
759 values, num_values); 759 values, num_values);
760 state->DelayWeakReferenceSet(reference_set); 760 state->DelayWeakReferenceSet(reference_set);
761 return Api::Success(); 761 return Api::Success();
762 } 762 }
763 763
764 764
765 // --- Garbage Collection Callbacks -- 765 // --- Garbage Collection Callbacks --
766 766
767 DART_EXPORT Dart_Handle Dart_AddGcPrologueCallback(
768 Dart_GcPrologueCallback callback) {
769 Isolate* isolate = Isolate::Current();
770 CHECK_ISOLATE(isolate);
771 if (isolate->gc_prologue_callback() != NULL) {
772 return Api::NewError(
773 "%s permits only one gc prologue callback to be registered, please "
774 "remove the existing callback using Dart_RemoveGcPrologueCallback "
775 "and then add this callback",
776 CURRENT_FUNC);
777 }
778 isolate->set_gc_prologue_callback(callback);
779 return Api::Success();
780 }
781
782
783 DART_EXPORT Dart_Handle Dart_RemoveGcPrologueCallback(
784 Dart_GcPrologueCallback callback) {
785 Isolate* isolate = Isolate::Current();
786 CHECK_ISOLATE(isolate);
787 if (isolate->gc_prologue_callback() != callback) {
788 return Api::NewError(
789 "%s expects 'callback' to be the currently registered gc prologue "
790 "callback.",
791 CURRENT_FUNC);
792 }
793 isolate->set_gc_prologue_callback(NULL);
794 return Api::Success();
795 }
796
797
798 DART_EXPORT Dart_Handle Dart_AddGcEpilogueCallback(
799 Dart_GcEpilogueCallback callback) {
800 Isolate* isolate = Isolate::Current();
801 CHECK_ISOLATE(isolate);
802 if (isolate->gc_epilogue_callback() != NULL) {
803 return Api::NewError(
804 "%s permits only one gc epilogue callback to be registered, please "
805 "remove the existing callback using Dart_RemoveGcEpilogueCallback "
806 "and then add this callback",
807 CURRENT_FUNC);
808 }
809 isolate->set_gc_epilogue_callback(callback);
810 return Api::Success();
811 }
812
813
814 DART_EXPORT Dart_Handle Dart_RemoveGcEpilogueCallback(
815 Dart_GcEpilogueCallback callback) {
816 Isolate* isolate = Isolate::Current();
817 CHECK_ISOLATE(isolate);
818 if (isolate->gc_epilogue_callback() != callback) {
819 return Api::NewError(
820 "%s expects 'callback' to be the currently registered gc epilogue "
821 " callback.",
822 CURRENT_FUNC);
823 }
824 isolate->set_gc_epilogue_callback(NULL);
825 return Api::Success();
826 }
827
828
829 DART_EXPORT Dart_Handle Dart_SetGcCallbacks( 767 DART_EXPORT Dart_Handle Dart_SetGcCallbacks(
830 Dart_GcPrologueCallback prologue_callback, 768 Dart_GcPrologueCallback prologue_callback,
831 Dart_GcEpilogueCallback epilogue_callback) { 769 Dart_GcEpilogueCallback epilogue_callback) {
832 Isolate* isolate = Isolate::Current(); 770 Isolate* isolate = Isolate::Current();
833 CHECK_ISOLATE(isolate); 771 CHECK_ISOLATE(isolate);
834 if (prologue_callback != NULL) { 772 if (prologue_callback != NULL) {
835 if (isolate->gc_prologue_callback() != NULL) { 773 if (isolate->gc_prologue_callback() != NULL) {
836 return Api::NewError( 774 return Api::NewError(
837 "%s permits only one gc prologue callback to be registered, please " 775 "%s permits only one gc prologue callback to be registered, please "
838 "remove the existing callback and then add this callback", 776 "remove the existing callback and then add this callback",
(...skipping 3855 matching lines...) Expand 10 before | Expand all | Expand 10 after
4694 4632
4695 4633
4696 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 4634 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
4697 const char* name, 4635 const char* name,
4698 Dart_ServiceRequestCallback callback, 4636 Dart_ServiceRequestCallback callback,
4699 void* user_data) { 4637 void* user_data) {
4700 Service::RegisterRootEmbedderCallback(name, callback, user_data); 4638 Service::RegisterRootEmbedderCallback(name, callback, user_data);
4701 } 4639 }
4702 4640
4703 } // namespace dart 4641 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698