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

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

Issue 62333025: [Android] Move CommandLine.java to base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.common; 5 package org.chromium.content.common;
6 6
7 import android.os.Build; 7 import android.os.Build;
8 import android.os.Looper; 8 import android.os.Looper;
9 import android.os.MessageQueue; 9 import android.os.MessageQueue;
10 import android.os.SystemClock; 10 import android.os.SystemClock;
11 import android.util.Log; 11 import android.util.Log;
12 import android.util.Printer; 12 import android.util.Printer;
13 13
14 import org.chromium.base.CommandLine;
14 import org.chromium.base.ThreadUtils; 15 import org.chromium.base.ThreadUtils;
16 import org.chromium.content.common.ContentSwitches;
15 17
16 import java.lang.reflect.InvocationTargetException; 18 import java.lang.reflect.InvocationTargetException;
17 import java.lang.reflect.Method; 19 import java.lang.reflect.Method;
18 20
19 // Java mirror of Chrome trace event API. See 21 // Java mirror of Chrome trace event API. See
20 // base/debug/trace_event.h. Unlike the native version, Java does not 22 // base/debug/trace_event.h. Unlike the native version, Java does not
21 // have stack objects, so a TRACE_EVENT() which does both 23 // have stack objects, so a TRACE_EVENT() which does both
22 // TRACE_EVENT_BEGIN() and TRACE_EVENT_END() in ctor/dtor is not 24 // TRACE_EVENT_BEGIN() and TRACE_EVENT_END() in ctor/dtor is not
23 // possible. 25 // possible.
24 // It is OK to use tracing before the native library has loaded, but such traces will 26 // It is OK to use tracing before the native library has loaded, but such traces will
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 162 }
161 mLastIdleStartedAt = now; 163 mLastIdleStartedAt = now;
162 mNumTasksSinceLastIdle = 0; 164 mNumTasksSinceLastIdle = 0;
163 return true; // stay installed 165 return true; // stay installed
164 } 166 }
165 } 167 }
166 168
167 // Holder for monitor avoids unnecessary construction on non-debug runs 169 // Holder for monitor avoids unnecessary construction on non-debug runs
168 private final static class LooperMonitorHolder { 170 private final static class LooperMonitorHolder {
169 private final static BasicLooperMonitor sInstance = 171 private final static BasicLooperMonitor sInstance =
170 CommandLine.getInstance().hasSwitch(CommandLine.ENABLE_IDLE_TRAC ING) ? 172 CommandLine.getInstance().hasSwitch(ContentSwitches.ENABLE_IDLE_ TRACING) ?
171 new IdleTracingLooperMonitor() : new BasicLooperMonitor( ); 173 new IdleTracingLooperMonitor() : new BasicLooperMonitor( );
172 } 174 }
173 175
174 private static long sTraceTagView; 176 private static long sTraceTagView;
175 private static Method sSystemPropertiesGetLongMethod; 177 private static Method sSystemPropertiesGetLongMethod;
176 private static final String PROPERTY_TRACE_TAG_ENABLEFLAGS = "debug.atrace.t ags.enableflags"; 178 private static final String PROPERTY_TRACE_TAG_ENABLEFLAGS = "debug.atrace.t ags.enableflags";
177 179
178 static { 180 static {
179 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 181 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
180 try { 182 try {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 409
408 private static native boolean nativeTraceEnabled(); 410 private static native boolean nativeTraceEnabled();
409 private static native void nativeStartATrace(); 411 private static native void nativeStartATrace();
410 private static native void nativeStopATrace(); 412 private static native void nativeStopATrace();
411 private static native void nativeInstant(String name, String arg); 413 private static native void nativeInstant(String name, String arg);
412 private static native void nativeBegin(String name, String arg); 414 private static native void nativeBegin(String name, String arg);
413 private static native void nativeEnd(String name, String arg); 415 private static native void nativeEnd(String name, String arg);
414 private static native void nativeStartAsync(String name, long id, String arg ); 416 private static native void nativeStartAsync(String name, long id, String arg );
415 private static native void nativeFinishAsync(String name, long id, String ar g); 417 private static native void nativeFinishAsync(String name, long id, String ar g);
416 } 418 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698