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

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

Issue 1851953002: Add API to set thread name (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « runtime/include/dart_tools_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 "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
(...skipping 5940 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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
OLDNEW
« no previous file with comments | « runtime/include/dart_tools_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