Commit 8bc85699 authored by ppi@chromium.org's avatar ppi@chromium.org

Add more tracing for launching Android Services.

This CLs adds trace events for ChildProcessLauncher::start() and
ChildServiceConnection::bind(), improving visibility of the service
startup events in traces.

BUG=363121
R=yfriedman@chromium.org

Review URL: https://codereview.chromium.org/258953008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266660 0039d316-1c4b-4281-b951-d872f2087c98
parent fb664a71
...@@ -114,6 +114,7 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection { ...@@ -114,6 +114,7 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection {
boolean bind(String[] commandLine) { boolean bind(String[] commandLine) {
if (!mBound) { if (!mBound) {
TraceEvent.begin();
final Intent intent = createServiceBindIntent(); final Intent intent = createServiceBindIntent();
if (commandLine != null) { if (commandLine != null) {
intent.putExtra(EXTRA_COMMAND_LINE, commandLine); intent.putExtra(EXTRA_COMMAND_LINE, commandLine);
...@@ -121,6 +122,7 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection { ...@@ -121,6 +122,7 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection {
if (mLinkerParams != null) if (mLinkerParams != null)
mLinkerParams.addIntentExtras(intent); mLinkerParams.addIntentExtras(intent);
mBound = mContext.bindService(intent, this, mBindFlags); mBound = mContext.bindService(intent, this, mBindFlags);
TraceEvent.end();
} }
return mBound; return mBound;
} }
......
...@@ -15,6 +15,7 @@ import com.google.common.annotations.VisibleForTesting; ...@@ -15,6 +15,7 @@ import com.google.common.annotations.VisibleForTesting;
import org.chromium.base.CalledByNative; import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace; import org.chromium.base.JNINamespace;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.base.TraceEvent;
import org.chromium.base.library_loader.Linker; import org.chromium.base.library_loader.Linker;
import org.chromium.content.app.ChildProcessService; import org.chromium.content.app.ChildProcessService;
import org.chromium.content.app.ChromiumLinkerParams; import org.chromium.content.app.ChromiumLinkerParams;
...@@ -338,6 +339,7 @@ public class ChildProcessLauncher { ...@@ -338,6 +339,7 @@ public class ChildProcessLauncher {
int[] fileFds, int[] fileFds,
boolean[] fileAutoClose, boolean[] fileAutoClose,
long clientContext) { long clientContext) {
TraceEvent.begin();
assert fileIds.length == fileFds.length && fileFds.length == fileAutoClose.length; assert fileIds.length == fileFds.length && fileFds.length == fileAutoClose.length;
FileDescriptorInfo[] filesToBeMapped = new FileDescriptorInfo[fileFds.length]; FileDescriptorInfo[] filesToBeMapped = new FileDescriptorInfo[fileFds.length];
for (int i = 0; i < fileFds.length; i++) { for (int i = 0; i < fileFds.length; i++) {
...@@ -369,6 +371,8 @@ public class ChildProcessLauncher { ...@@ -369,6 +371,8 @@ public class ChildProcessLauncher {
if (allocatedConnection == null) { if (allocatedConnection == null) {
// Notify the native code so it can free the heap allocated callback. // Notify the native code so it can free the heap allocated callback.
nativeOnChildProcessStarted(clientContext, 0); nativeOnChildProcessStarted(clientContext, 0);
Log.e(TAG, "Allocation of new service failed.");
TraceEvent.end();
return; return;
} }
} }
...@@ -377,6 +381,7 @@ public class ChildProcessLauncher { ...@@ -377,6 +381,7 @@ public class ChildProcessLauncher {
allocatedConnection.getServiceNumber()); allocatedConnection.getServiceNumber());
triggerConnectionSetup(allocatedConnection, commandLine, childProcessId, filesToBeMapped, triggerConnectionSetup(allocatedConnection, commandLine, childProcessId, filesToBeMapped,
callbackType, clientContext); callbackType, clientContext);
TraceEvent.end();
} }
@VisibleForTesting @VisibleForTesting
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment