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" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return Object::null(); | 103 return Object::null(); |
104 } | 104 } |
105 | 105 |
106 DartTimelineEventHelpers::ReportCompleteEvent( | 106 DartTimelineEventHelpers::ReportCompleteEvent( |
107 thread, zone, event, start.AsInt64Value(), start_cpu.AsInt64Value(), | 107 thread, zone, event, start.AsInt64Value(), start_cpu.AsInt64Value(), |
108 category.ToCString(), name.ToCString(), args.ToCString()); | 108 category.ToCString(), name.ToCString(), args.ToCString()); |
109 #endif // !defined(PRODUCT) | 109 #endif // !defined(PRODUCT) |
110 return Object::null(); | 110 return Object::null(); |
111 } | 111 } |
112 | 112 |
| 113 DEFINE_NATIVE_ENTRY(Timeline_reportFlowEvent, 7) { |
| 114 #ifndef PRODUCT |
| 115 if (!FLAG_support_timeline) { |
| 116 return Object::null(); |
| 117 } |
| 118 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0)); |
| 119 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start_cpu, arguments->NativeArgAt(1)); |
| 120 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(2)); |
| 121 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(3)); |
| 122 GET_NON_NULL_NATIVE_ARGUMENT(Integer, type, arguments->NativeArgAt(4)); |
| 123 GET_NON_NULL_NATIVE_ARGUMENT(Integer, flow_id, arguments->NativeArgAt(5)); |
| 124 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(6)); |
| 125 |
| 126 TimelineEventRecorder* recorder = Timeline::recorder(); |
| 127 if (recorder == NULL) { |
| 128 return Object::null(); |
| 129 } |
| 130 |
| 131 TimelineEvent* event = Timeline::GetDartStream()->StartEvent(); |
| 132 if (event == NULL) { |
| 133 // Stream was turned off. |
| 134 return Object::null(); |
| 135 } |
| 136 |
| 137 DartTimelineEventHelpers::ReportFlowEvent( |
| 138 thread, zone, event, start.AsInt64Value(), start_cpu.AsInt64Value(), |
| 139 category.ToCString(), name.ToCString(), type.AsInt64Value(), |
| 140 flow_id.AsInt64Value(), args.ToCString()); |
| 141 #endif // !defined(PRODUCT) |
| 142 return Object::null(); |
| 143 } |
| 144 |
113 DEFINE_NATIVE_ENTRY(Timeline_reportInstantEvent, 4) { | 145 DEFINE_NATIVE_ENTRY(Timeline_reportInstantEvent, 4) { |
114 #ifndef PRODUCT | 146 #ifndef PRODUCT |
115 if (!FLAG_support_timeline) { | 147 if (!FLAG_support_timeline) { |
116 return Object::null(); | 148 return Object::null(); |
117 } | 149 } |
118 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0)); | 150 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0)); |
119 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(1)); | 151 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(1)); |
120 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(2)); | 152 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(2)); |
121 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(3)); | 153 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(3)); |
122 | 154 |
123 TimelineEventRecorder* recorder = Timeline::recorder(); | 155 TimelineEventRecorder* recorder = Timeline::recorder(); |
124 if (recorder == NULL) { | 156 if (recorder == NULL) { |
125 return Object::null(); | 157 return Object::null(); |
126 } | 158 } |
127 | 159 |
128 TimelineEvent* event = Timeline::GetDartStream()->StartEvent(); | 160 TimelineEvent* event = Timeline::GetDartStream()->StartEvent(); |
129 if (event == NULL) { | 161 if (event == NULL) { |
130 // Stream was turned off. | 162 // Stream was turned off. |
131 return Object::null(); | 163 return Object::null(); |
132 } | 164 } |
133 | 165 |
134 DartTimelineEventHelpers::ReportInstantEvent( | 166 DartTimelineEventHelpers::ReportInstantEvent( |
135 thread, zone, event, start.AsInt64Value(), category.ToCString(), | 167 thread, zone, event, start.AsInt64Value(), category.ToCString(), |
136 name.ToCString(), args.ToCString()); | 168 name.ToCString(), args.ToCString()); |
137 #endif | 169 #endif |
138 return Object::null(); | 170 return Object::null(); |
139 } | 171 } |
140 | 172 |
141 } // namespace dart | 173 } // namespace dart |
OLD | NEW |