| 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 5849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5860 return Api::NewError( | 5860 return Api::NewError( |
| 5861 "%s expects 'cancel_callback' to be present in the callback set.", | 5861 "%s expects 'cancel_callback' to be present in the callback set.", |
| 5862 CURRENT_FUNC); | 5862 CURRENT_FUNC); |
| 5863 } | 5863 } |
| 5864 } | 5864 } |
| 5865 Service::SetEmbedderStreamCallbacks(listen_callback, cancel_callback); | 5865 Service::SetEmbedderStreamCallbacks(listen_callback, cancel_callback); |
| 5866 return Api::Success(); | 5866 return Api::Success(); |
| 5867 } | 5867 } |
| 5868 | 5868 |
| 5869 | 5869 |
| 5870 DART_EXPORT int64_t Dart_TimelineGetMicros() { |
| 5871 return OS::GetCurrentMonotonicMicros(); |
| 5872 } |
| 5873 |
| 5874 |
| 5875 #if defined(PRODUCT) |
| 5870 DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id, | 5876 DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id, |
| 5871 const char* event_kind, | 5877 const char* event_kind, |
| 5872 const uint8_t* bytes, | 5878 const uint8_t* bytes, |
| 5873 intptr_t bytes_length) { | 5879 intptr_t bytes_length) { |
| 5874 #if defined(PRODUCT) | |
| 5875 return Api::Success(); | 5880 return Api::Success(); |
| 5881 } |
| 5882 |
| 5883 |
| 5884 DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) { |
| 5885 return; |
| 5886 } |
| 5887 |
| 5888 |
| 5889 DART_EXPORT void Dart_SetEmbedderTimelineCallbacks( |
| 5890 Dart_EmbedderTimelineStartRecording start_recording, |
| 5891 Dart_EmbedderTimelineStopRecording stop_recording) { |
| 5892 return; |
| 5893 } |
| 5894 |
| 5895 |
| 5896 DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, |
| 5897 void* user_data) { |
| 5898 return false; |
| 5899 } |
| 5900 |
| 5901 |
| 5902 DART_EXPORT void Dart_TimelineEvent(const char* label, |
| 5903 int64_t timestamp0, |
| 5904 int64_t timestamp1_or_async_id, |
| 5905 Dart_Timeline_Event_Type type, |
| 5906 intptr_t argument_count, |
| 5907 const char** argument_names, |
| 5908 const char** argument_values) { |
| 5909 return; |
| 5910 } |
| 5876 #else // defined(PRODUCT) | 5911 #else // defined(PRODUCT) |
| 5912 DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id, |
| 5913 const char* event_kind, |
| 5914 const uint8_t* bytes, |
| 5915 intptr_t bytes_length) { |
| 5877 DARTSCOPE(Thread::Current()); | 5916 DARTSCOPE(Thread::Current()); |
| 5878 Isolate* I = T->isolate(); | 5917 Isolate* I = T->isolate(); |
| 5879 if (stream_id == NULL) { | 5918 if (stream_id == NULL) { |
| 5880 RETURN_NULL_ERROR(stream_id); | 5919 RETURN_NULL_ERROR(stream_id); |
| 5881 } | 5920 } |
| 5882 if (event_kind == NULL) { | 5921 if (event_kind == NULL) { |
| 5883 RETURN_NULL_ERROR(event_kind); | 5922 RETURN_NULL_ERROR(event_kind); |
| 5884 } | 5923 } |
| 5885 if (bytes == NULL) { | 5924 if (bytes == NULL) { |
| 5886 RETURN_NULL_ERROR(bytes); | 5925 RETURN_NULL_ERROR(bytes); |
| 5887 } | 5926 } |
| 5888 if (bytes_length < 0) { | 5927 if (bytes_length < 0) { |
| 5889 return Api::NewError("%s expects argument 'bytes_length' to be >= 0.", | 5928 return Api::NewError("%s expects argument 'bytes_length' to be >= 0.", |
| 5890 CURRENT_FUNC); | 5929 CURRENT_FUNC); |
| 5891 } | 5930 } |
| 5892 Service::SendEmbedderEvent(I, stream_id, event_kind, | 5931 Service::SendEmbedderEvent(I, stream_id, event_kind, |
| 5893 bytes, bytes_length); | 5932 bytes, bytes_length); |
| 5894 return Api::Success(); | 5933 return Api::Success(); |
| 5895 #endif // defined(PRODUCT) | |
| 5896 } | 5934 } |
| 5897 | 5935 |
| 5898 | 5936 |
| 5899 DART_EXPORT int64_t Dart_TimelineGetMicros() { | |
| 5900 return OS::GetCurrentMonotonicMicros(); | |
| 5901 } | |
| 5902 | |
| 5903 | |
| 5904 DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) { | 5937 DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask) { |
| 5905 if (!FLAG_support_timeline) { | 5938 if (!FLAG_support_timeline) { |
| 5906 return; | 5939 return; |
| 5907 } | 5940 } |
| 5908 const bool api_enabled = (stream_mask & DART_TIMELINE_STREAM_API) != 0; | 5941 const bool api_enabled = (stream_mask & DART_TIMELINE_STREAM_API) != 0; |
| 5909 const bool compiler_enabled = | 5942 const bool compiler_enabled = |
| 5910 (stream_mask & DART_TIMELINE_STREAM_COMPILER) != 0; | 5943 (stream_mask & DART_TIMELINE_STREAM_COMPILER) != 0; |
| 5911 const bool dart_enabled = | 5944 const bool dart_enabled = |
| 5912 (stream_mask & DART_TIMELINE_STREAM_DART) != 0; | 5945 (stream_mask & DART_TIMELINE_STREAM_DART) != 0; |
| 5913 const bool debugger_enabled = | 5946 const bool debugger_enabled = |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6118 default: | 6151 default: |
| 6119 FATAL("Unknown Dart_Timeline_Event_Type"); | 6152 FATAL("Unknown Dart_Timeline_Event_Type"); |
| 6120 } | 6153 } |
| 6121 event->set_owns_label(true); | 6154 event->set_owns_label(true); |
| 6122 event->SetNumArguments(argument_count); | 6155 event->SetNumArguments(argument_count); |
| 6123 for (intptr_t i = 0; i < argument_count; i++) { | 6156 for (intptr_t i = 0; i < argument_count; i++) { |
| 6124 event->CopyArgument(i, argument_names[i], argument_values[i]); | 6157 event->CopyArgument(i, argument_names[i], argument_values[i]); |
| 6125 } | 6158 } |
| 6126 event->Complete(); | 6159 event->Complete(); |
| 6127 } | 6160 } |
| 6161 #endif // defined(PRODUCT) |
| 6128 | 6162 |
| 6129 | 6163 |
| 6130 DART_EXPORT void Dart_SetThreadName(const char* name) { | 6164 DART_EXPORT void Dart_SetThreadName(const char* name) { |
| 6131 OSThread* thread = OSThread::Current(); | 6165 OSThread* thread = OSThread::Current(); |
| 6132 if (thread == NULL) { | 6166 if (thread == NULL) { |
| 6133 // VM is shutting down. | 6167 // VM is shutting down. |
| 6134 return; | 6168 return; |
| 6135 } | 6169 } |
| 6136 thread->SetName(name); | 6170 thread->SetName(name); |
| 6137 } | 6171 } |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6440 | 6474 |
| 6441 DART_EXPORT bool Dart_IsPrecompiledRuntime() { | 6475 DART_EXPORT bool Dart_IsPrecompiledRuntime() { |
| 6442 #if defined(DART_PRECOMPILED_RUNTIME) | 6476 #if defined(DART_PRECOMPILED_RUNTIME) |
| 6443 return true; | 6477 return true; |
| 6444 #else | 6478 #else |
| 6445 return false; | 6479 return false; |
| 6446 #endif | 6480 #endif |
| 6447 } | 6481 } |
| 6448 | 6482 |
| 6449 } // namespace dart | 6483 } // namespace dart |
| OLD | NEW |