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

Unified Diff: runtime/lib/timeline.cc

Issue 2984603002: Special-case Timeline.{start,finish}Sync for Fuchsia (Closed)
Patch Set: . Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/lib/timeline.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/timeline.cc
diff --git a/runtime/lib/timeline.cc b/runtime/lib/timeline.cc
index ce4b43f6d24e7bd2e70ab4055fb4234b73178d40..24c559c12e4871f0e88146274327c658024b6335 100644
--- a/runtime/lib/timeline.cc
+++ b/runtime/lib/timeline.cc
@@ -111,16 +111,36 @@ DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) {
return Object::null();
}
+DEFINE_NATIVE_ENTRY(Timeline_reportBeginEvent, 1) {
+#if !defined(PRODUCT) && defined(HOST_OS_FUCHSIA)
+ if (!FLAG_support_timeline) {
+ return Object::null();
+ }
+ GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0));
+
+ TimelineEventRecorder* recorder = Timeline::recorder();
+ if (recorder == NULL) {
+ return Object::null();
+ }
+
+ TimelineEvent* event = Timeline::GetDartStream()->StartEvent();
+ if (event == NULL) {
+ // Stream was turned off.
+ return Object::null();
+ }
+
+ event->Begin(strdup(name.ToCString()));
+ event->set_owns_label(true);
+ event->Complete();
+#endif // !PRODUCT
+ return Object::null();
+}
+
DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 5) {
#ifndef PRODUCT
if (!FLAG_support_timeline) {
return Object::null();
}
- GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0));
- GET_NON_NULL_NATIVE_ARGUMENT(Integer, start_cpu, arguments->NativeArgAt(1));
- GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(2));
- GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(3));
- GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(4));
TimelineEventRecorder* recorder = Timeline::recorder();
if (recorder == NULL) {
@@ -133,6 +153,19 @@ DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 5) {
return Object::null();
}
+ GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(3));
+ GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(4));
+#if defined(HOST_OS_FUCHSIA)
konkers 2017/07/19 22:11:20 This is not strictly necessary. It does, however,
+ event->End(strdup(name.ToCString()));
+ event->set_owns_label(true);
+ event->SetNumArguments(1);
+ event->CopyArgument(0, "args", args.ToCString());
+ event->Complete();
+#else
+ GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0));
+ GET_NON_NULL_NATIVE_ARGUMENT(Integer, start_cpu, arguments->NativeArgAt(1));
+ GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(2));
+
const int64_t end = OS::GetCurrentMonotonicMicros();
const int64_t end_cpu = OS::GetCurrentThreadCPUMicros();
const int64_t duration = end - start.AsInt64Value();
@@ -169,7 +202,8 @@ DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 5) {
end_cpu);
// json was allocated in the zone and a copy will be stored in event.
event->CompleteWithPreSerializedJSON(json);
-#endif
+#endif // defined(HOST_OS_FUCHSIA)
+#endif // !defined(PRODUCT)
return Object::null();
}
« no previous file with comments | « no previous file | runtime/lib/timeline.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698