Merge "Remove unnecessary finally blocks for tracing."

This commit is contained in:
Yasuhiro Matsuda
2015-09-04 02:23:31 +00:00
committed by Gerrit Code Review

View File

@@ -182,19 +182,15 @@ public class ZygoteInit {
static void preload() { static void preload() {
Log.d(TAG, "begin preload"); Log.d(TAG, "begin preload");
try {
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadClasses"); Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadClasses");
preloadClasses(); preloadClasses();
} finally {
Trace.traceEnd(Trace.TRACE_TAG_DALVIK); Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
}
try {
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadResources"); Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadResources");
preloadResources(); preloadResources();
} finally {
Trace.traceEnd(Trace.TRACE_TAG_DALVIK); Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
} Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadOpenGL");
preloadOpenGL(); preloadOpenGL();
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
preloadSharedLibraries(); preloadSharedLibraries();
// Ask the WebViewFactory to do any initialization that must run in the zygote process, // Ask the WebViewFactory to do any initialization that must run in the zygote process,
// for memory sharing purposes. // for memory sharing purposes.
@@ -273,8 +269,8 @@ public class ZygoteInit {
continue; continue;
} }
try {
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadClass " + line); Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadClass " + line);
try {
if (false) { if (false) {
Log.v(TAG, "Preloading " + line + "..."); Log.v(TAG, "Preloading " + line + "...");
} }
@@ -298,9 +294,8 @@ public class ZygoteInit {
throw (RuntimeException) t; throw (RuntimeException) t;
} }
throw new RuntimeException(t); throw new RuntimeException(t);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
} }
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
} }
Log.i(TAG, "...preloaded " + count + " classes in " Log.i(TAG, "...preloaded " + count + " classes in "
@@ -575,16 +570,15 @@ public class ZygoteInit {
} }
public static void main(String argv[]) { public static void main(String argv[]) {
try {
boolean startSystemServer = false;
String socketName = "zygote";
String abiList = null;
try { try {
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "ZygoteInit"); Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "ZygoteInit");
RuntimeInit.enableDdms(); RuntimeInit.enableDdms();
// Start profiling the zygote initialization. // Start profiling the zygote initialization.
SamplingProfilerIntegration.start(); SamplingProfilerIntegration.start();
boolean startSystemServer = false;
String socketName = "zygote";
String abiList = null;
for (int i = 1; i < argv.length; i++) { for (int i = 1; i < argv.length; i++) {
if ("start-system-server".equals(argv[i])) { if ("start-system-server".equals(argv[i])) {
startSystemServer = true; startSystemServer = true;
@@ -602,30 +596,23 @@ public class ZygoteInit {
} }
registerZygoteSocket(socketName); registerZygoteSocket(socketName);
try {
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "ZygotePreload"); Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "ZygotePreload");
EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_START, EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_START,
SystemClock.uptimeMillis()); SystemClock.uptimeMillis());
preload(); preload();
EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_END, EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_END,
SystemClock.uptimeMillis()); SystemClock.uptimeMillis());
} finally {
Trace.traceEnd(Trace.TRACE_TAG_DALVIK); Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
}
// Finish profiling the zygote initialization. // Finish profiling the zygote initialization.
SamplingProfilerIntegration.writeZygoteSnapshot(); SamplingProfilerIntegration.writeZygoteSnapshot();
// Do an initial gc to clean up after startup // Do an initial gc to clean up after startup
try {
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PostZygoteInitGC"); Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PostZygoteInitGC");
gcAndFinalize(); gcAndFinalize();
} finally {
Trace.traceEnd(Trace.TRACE_TAG_DALVIK); Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
}
} finally {
Trace.traceEnd(Trace.TRACE_TAG_DALVIK); Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
}
// Disable tracing so that forked processes do not inherit stale tracing tags from // Disable tracing so that forked processes do not inherit stale tracing tags from
// Zygote. // Zygote.