| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 "vm/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "vm/native_entry.h" | 9 #include "vm/native_entry.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 #include "vm/os.h" | 11 #include "vm/os.h" |
| 12 #include "vm/timeline.h" | 12 #include "vm/timeline.h" |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 // Native implementations for the dart:developer library. | 16 // Native implementations for the dart:developer library. |
| 17 | 17 |
| 18 DEFINE_NATIVE_ENTRY(Timeline_isDartStreamEnabled, 0) { |
| 19 if (!FLAG_support_timeline) { |
| 20 return Bool::False().raw(); |
| 21 } |
| 22 if (Timeline::GetDartStream()->enabled()) { |
| 23 return Bool::True().raw(); |
| 24 } |
| 25 return Bool::False().raw(); |
| 26 } |
| 27 |
| 28 |
| 18 DEFINE_NATIVE_ENTRY(Timeline_getIsolateNum, 0) { | 29 DEFINE_NATIVE_ENTRY(Timeline_getIsolateNum, 0) { |
| 19 return Integer::New(static_cast<int64_t>(isolate->main_port()), Heap::kOld); | 30 return Integer::New(static_cast<int64_t>(isolate->main_port()), Heap::kOld); |
| 20 } | 31 } |
| 21 | 32 |
| 22 | 33 |
| 23 DEFINE_NATIVE_ENTRY(Timeline_getNextAsyncId, 0) { | 34 DEFINE_NATIVE_ENTRY(Timeline_getNextAsyncId, 0) { |
| 24 if (!FLAG_support_timeline) { | 35 if (!FLAG_support_timeline) { |
| 25 return Integer::New(0); | 36 return Integer::New(0); |
| 26 } | 37 } |
| 27 TimelineEventRecorder* recorder = Timeline::recorder(); | 38 TimelineEventRecorder* recorder = Timeline::recorder(); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 args.ToCString()); | 226 args.ToCString()); |
| 216 | 227 |
| 217 event->Instant("", start.AsInt64Value()); | 228 event->Instant("", start.AsInt64Value()); |
| 218 // json was allocated in the zone and a copy will be stored in event. | 229 // json was allocated in the zone and a copy will be stored in event. |
| 219 event->CompleteWithPreSerializedJSON(json); | 230 event->CompleteWithPreSerializedJSON(json); |
| 220 | 231 |
| 221 return Object::null(); | 232 return Object::null(); |
| 222 } | 233 } |
| 223 | 234 |
| 224 } // namespace dart | 235 } // namespace dart |
| OLD | NEW |