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

Unified Diff: runtime/vm/dart_api_impl.h

Issue 23453035: 1. Add flag --trace-api to trace API function invocation (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
Index: runtime/vm/dart_api_impl.h
===================================================================
--- runtime/vm/dart_api_impl.h (revision 27137)
+++ runtime/vm/dart_api_impl.h (working copy)
@@ -11,6 +11,8 @@
namespace dart {
+DECLARE_FLAG(bool, trace_api);
+
class ApiLocalScope;
class ApiState;
class FinalizablePersistentHandle;
@@ -21,9 +23,20 @@
#define CURRENT_FUNC CanonicalFunction(__FUNCTION__)
+#if defined(DEBUG)
+#define TRACE_API_CALLS(name) \
regis 2013/09/04 23:05:15 Should it be TRACE_API_CALL(name), since you use i
siva 2013/09/04 23:27:42 Done.
+ if (FLAG_trace_api) { \
+ OS::Print("Calling API func: %s\n", name); \
+ }
+#else
+#define TRACE_API_CALLS(name)
+#endif
+
+
// Checks that the current isolate is not NULL.
#define CHECK_ISOLATE(isolate) \
do { \
+ TRACE_API_CALLS(CURRENT_FUNC); \
if ((isolate) == NULL) { \
FATAL1("%s expects there to be a current isolate. Did you " \
"forget to call Dart_CreateIsolate or Dart_EnterIsolate?", \
@@ -34,6 +47,7 @@
// Checks that the current isolate is NULL.
#define CHECK_NO_ISOLATE(isolate) \
do { \
+ TRACE_API_CALLS(CURRENT_FUNC); \
if ((isolate) != NULL) { \
FATAL1("%s expects there to be no current isolate. Did you " \
"forget to call Dart_ExitIsolate?", CURRENT_FUNC); \

Powered by Google App Engine
This is Rietveld 408576698