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

Unified Diff: content/public/android/java/src/org/chromium/content/common/TraceEvent.java

Issue 11090082: Move PerfTest TraceEvent to async (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build break Created 8 years, 2 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 | « content/public/android/java/src/org/chromium/content/common/PerfTraceEvent.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/common/TraceEvent.java
diff --git a/content/public/android/java/src/org/chromium/content/common/TraceEvent.java b/content/public/android/java/src/org/chromium/content/common/TraceEvent.java
index 458db8bfb1be63edb402c1f641be065f304d9903..143ca2be23a0c02674238429acc12395ea48f1f4 100644
--- a/content/public/android/java/src/org/chromium/content/common/TraceEvent.java
+++ b/content/public/android/java/src/org/chromium/content/common/TraceEvent.java
@@ -44,9 +44,7 @@ public class TraceEvent {
* The native library must be loaded before the first call with enabled == true.
*/
public static synchronized void setEnabled(boolean enabled) {
- if (sEnabled == enabled) {
- return;
- }
+ if (sEnabled == enabled) return;
sEnabled = enabled;
Looper.getMainLooper().setMessageLogging(enabled ? new LooperTracePrinter() : null);
}
@@ -60,16 +58,83 @@ public class TraceEvent {
return sEnabled;
}
+ /**
+ * Triggers the 'instant' native trace event with no arguments.
+ * @param name The name of the event.
+ */
public static void instant(String name) {
- if (sEnabled) {
- nativeInstant(name, null);
- }
+ if (sEnabled) nativeInstant(name, null);
}
+ /**
+ * Triggers the 'instant' native trace event.
+ * @param name The name of the event.
+ * @param arg The arguments of the event.
+ */
public static void instant(String name, String arg) {
- if (sEnabled) {
- nativeInstant(name, arg);
- }
+ if (sEnabled) nativeInstant(name, arg);
+ }
+
+ /**
+ * Convenience wrapper around the versions of startAsync() that take string parameters.
+ * @param id The id of the asynchronous event. Will automatically figure out the name from
+ * calling {@link #getCallerName()}.
+ * @see #begin()
+ */
+ public static void startAsync(long id) {
+ if (sEnabled) nativeStartAsync(getCallerName(), id, null);
+ }
+
+ /**
+ * Triggers the 'start' native trace event with no arguments.
+ * @param name The name of the event.
+ * @param id The id of the asynchronous event.
+ * @see #begin()
+ */
+ public static void startAsync(String name, long id) {
+ if (sEnabled) nativeStartAsync(name, id, null);
+ }
+
+ /**
+ * Triggers the 'start' native trace event.
+ * @param name The name of the event.
+ * @param id The id of the asynchronous event.
+ * @param arg The arguments of the event.
+ * @see #begin()
+ */
+ public static void startAsync(String name, long id, String arg) {
+ if (sEnabled) nativeStartAsync(name, id, arg);
+ }
+
+ /**
+ * Convenience wrapper around the versions of finishAsync() that take string parameters.
+ * @param id The id of the asynchronous event. Will automatically figure out the name from
+ * calling {@link #getCallerName()}.
+ * @see #finish()
+ */
+ public static void finishAsync(long id) {
+ if (sEnabled) nativeFinishAsync(getCallerName(), id, null);
+ }
+
+ /**
+ * Triggers the 'finish' native trace event with no arguments.
+ * @param name The name of the event.
+ * @param id The id of the asynchronous event.
+ * @see #begin()
+ */
+ public static void finishAsync(String name, long id) {
+ if (sEnabled) nativeFinishAsync(name, id, null);
+ }
+
+ /**
+ * Triggers the 'finish' native trace event.
+ * @param name The name of the event.
+ * @param id The id of the asynchronous event.
+ * @param arg The arguments of the event.
+ * @see #begin()
+ */
+ public static void finishAsync(String name, long id, String arg) {
+ if (sEnabled) nativeFinishAsync(name, id, arg);
}
/**
@@ -79,21 +144,24 @@ public class TraceEvent {
* same calling context.
*/
public static void begin() {
- if (sEnabled) {
- nativeBegin(getCallerName(), null);
- }
+ if (sEnabled) nativeBegin(getCallerName(), null);
}
+ /**
+ * Triggers the 'begin' native trace event with no arguments.
+ * @param name The name of the event.
+ */
public static void begin(String name) {
- if (sEnabled) {
- nativeBegin(name, null);
- }
+ if (sEnabled) nativeBegin(name, null);
}
+ /**
+ * Triggers the 'begin' native trace event.
+ * @param name The name of the event.
+ * @param arg The arguments of the event.
+ */
public static void begin(String name, String arg) {
- if (sEnabled) {
- nativeBegin(name, arg);
- }
+ if (sEnabled) nativeBegin(name, arg);
}
/**
@@ -106,12 +174,21 @@ public class TraceEvent {
}
}
+ /**
+ * Triggers the 'end' native trace event with no arguments.
+ * @param name The name of the event.
+ */
public static void end(String name) {
if (sEnabled) {
nativeEnd(name, null);
}
}
+ /**
+ * Triggers the 'end' native trace event.
+ * @param name The name of the event.
+ * @param arg The arguments of the event.
+ */
public static void end(String name, String arg) {
if (sEnabled) {
nativeEnd(name, arg);
@@ -137,4 +214,6 @@ public class TraceEvent {
private static native void nativeInstant(String name, String arg);
private static native void nativeBegin(String name, String arg);
private static native void nativeEnd(String name, String arg);
+ private static native void nativeStartAsync(String name, long id, String arg);
+ private static native void nativeFinishAsync(String name, long id, String arg);
}
« no previous file with comments | « content/public/android/java/src/org/chromium/content/common/PerfTraceEvent.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698