| OLD | NEW |
| 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 "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
| (...skipping 5940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5951 Dart_Timeline_Event_Type type, | 5951 Dart_Timeline_Event_Type type, |
| 5952 intptr_t argument_count, | 5952 intptr_t argument_count, |
| 5953 const char** argument_names, | 5953 const char** argument_names, |
| 5954 const char** argument_values) { | 5954 const char** argument_values) { |
| 5955 if (!FLAG_support_timeline) { | 5955 if (!FLAG_support_timeline) { |
| 5956 return; | 5956 return; |
| 5957 } | 5957 } |
| 5958 if (type < Dart_Timeline_Event_Begin) { | 5958 if (type < Dart_Timeline_Event_Begin) { |
| 5959 return; | 5959 return; |
| 5960 } | 5960 } |
| 5961 if (type > Dart_Timeline_Event_Metadata) { | 5961 if (type > Dart_Timeline_Event_Counter) { |
| 5962 return; | 5962 return; |
| 5963 } | 5963 } |
| 5964 TimelineStream* stream = Timeline::GetEmbedderStream(); | 5964 TimelineStream* stream = Timeline::GetEmbedderStream(); |
| 5965 ASSERT(stream != NULL); | 5965 ASSERT(stream != NULL); |
| 5966 TimelineEvent* event = stream->StartEvent(); | 5966 TimelineEvent* event = stream->StartEvent(); |
| 5967 if (event == NULL) { | 5967 if (event == NULL) { |
| 5968 return; | 5968 return; |
| 5969 } | 5969 } |
| 5970 switch (type) { | 5970 switch (type) { |
| 5971 case Dart_Timeline_Event_Begin: | 5971 case Dart_Timeline_Event_Begin: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5985 break; | 5985 break; |
| 5986 case Dart_Timeline_Event_Async_End: | 5986 case Dart_Timeline_Event_Async_End: |
| 5987 event->AsyncEnd(label, timestamp1_or_async_id, timestamp0); | 5987 event->AsyncEnd(label, timestamp1_or_async_id, timestamp0); |
| 5988 break; | 5988 break; |
| 5989 case Dart_Timeline_Event_Async_Instant: | 5989 case Dart_Timeline_Event_Async_Instant: |
| 5990 event->AsyncInstant(label, timestamp1_or_async_id, timestamp0); | 5990 event->AsyncInstant(label, timestamp1_or_async_id, timestamp0); |
| 5991 break; | 5991 break; |
| 5992 case Dart_Timeline_Event_Counter: | 5992 case Dart_Timeline_Event_Counter: |
| 5993 event->Counter(label, timestamp0); | 5993 event->Counter(label, timestamp0); |
| 5994 break; | 5994 break; |
| 5995 case Dart_Timeline_Event_Metadata: | |
| 5996 event->Metadata(label, timestamp0); | |
| 5997 break; | |
| 5998 default: | 5995 default: |
| 5999 FATAL("Unknown Dart_Timeline_Event_Type"); | 5996 FATAL("Unknown Dart_Timeline_Event_Type"); |
| 6000 } | 5997 } |
| 6001 event->SetNumArguments(argument_count); | 5998 event->SetNumArguments(argument_count); |
| 6002 for (intptr_t i = 0; i < argument_count; i++) { | 5999 for (intptr_t i = 0; i < argument_count; i++) { |
| 6003 event->CopyArgument(i, argument_names[i], argument_values[i]); | 6000 event->CopyArgument(i, argument_names[i], argument_values[i]); |
| 6004 } | 6001 } |
| 6005 event->Complete(); | 6002 event->Complete(); |
| 6006 } | 6003 } |
| 6007 | 6004 |
| 6008 | 6005 |
| 6006 DART_EXPORT void Dart_SetThreadName(const char* name) { |
| 6007 OSThread* thread = OSThread::Current(); |
| 6008 if (thread == NULL) { |
| 6009 // VM is shutting down. |
| 6010 return; |
| 6011 } |
| 6012 thread->SetName(name); |
| 6013 } |
| 6014 |
| 6015 |
| 6009 // The precompiler is included in dart_bootstrap and dart_noopt, and | 6016 // The precompiler is included in dart_bootstrap and dart_noopt, and |
| 6010 // excluded from dart and dart_precompiled_runtime. | 6017 // excluded from dart and dart_precompiled_runtime. |
| 6011 #if !defined(DART_PRECOMPILER) | 6018 #if !defined(DART_PRECOMPILER) |
| 6012 | 6019 |
| 6013 DART_EXPORT Dart_Handle Dart_Precompile( | 6020 DART_EXPORT Dart_Handle Dart_Precompile( |
| 6014 Dart_QualifiedFunctionName entry_points[], | 6021 Dart_QualifiedFunctionName entry_points[], |
| 6015 bool reset_fields) { | 6022 bool reset_fields) { |
| 6016 UNREACHABLE(); | 6023 UNREACHABLE(); |
| 6017 return 0; | 6024 return 0; |
| 6018 } | 6025 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6104 return Api::Success(); | 6111 return Api::Success(); |
| 6105 } | 6112 } |
| 6106 #endif // DART_PRECOMPILER | 6113 #endif // DART_PRECOMPILER |
| 6107 | 6114 |
| 6108 | 6115 |
| 6109 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { | 6116 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { |
| 6110 return Dart::IsRunningPrecompiledCode(); | 6117 return Dart::IsRunningPrecompiledCode(); |
| 6111 } | 6118 } |
| 6112 | 6119 |
| 6113 } // namespace dart | 6120 } // namespace dart |
| OLD | NEW |