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

Unified Diff: content/public/android/java/src/org/chromium/content/app/ChildProcessService.java

Issue 1314823003: Make Linker.isUsed() static, and clean up the fallout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tiny log tweak, protected->private, rebase to master. Created 5 years, 4 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
Index: content/public/android/java/src/org/chromium/content/app/ChildProcessService.java
diff --git a/content/public/android/java/src/org/chromium/content/app/ChildProcessService.java b/content/public/android/java/src/org/chromium/content/app/ChildProcessService.java
index 5385b7c1c6d153e85cdad3748c500b9238f9a7a1..e6f6bc03dcabafdb5ec008ae7a8734f887788568 100644
--- a/content/public/android/java/src/org/chromium/content/app/ChildProcessService.java
+++ b/content/public/android/java/src/org/chromium/content/app/ChildProcessService.java
@@ -69,6 +69,19 @@ public class ChildProcessService extends Service {
private final Semaphore mActivitySemaphore = new Semaphore(1);
+ // Return a Linker instance. If testing, the Linker needs special setup.
+ private Linker getLinker() {
+ if (Linker.areTestsEnabled()) {
+ // For testing, set the Linker implementation and the test runner
+ // class name to match those used by the parent.
+ assert mLinkerParams != null;
+ Linker.setupForTesting(
+ mLinkerParams.mLinkerImplementationForTesting,
+ mLinkerParams.mTestRunnerClassNameForTesting);
+ }
+ return Linker.getInstance();
+ }
+
// Binder object used by clients for this service.
private final IChildProcessService.Stub mBinder = new IChildProcessService.Stub() {
// NOTE: Implement any IChildProcessService methods here.
@@ -97,7 +110,7 @@ public class ChildProcessService extends Service {
System.arraycopy(fdInfosAsParcelable, 0, mFdInfos, 0, fdInfosAsParcelable.length);
Bundle sharedRelros = args.getBundle(Linker.EXTRA_LINKER_SHARED_RELROS);
if (sharedRelros != null) {
- Linker.getInstance().useSharedRelros(sharedRelros);
+ getLinker().useSharedRelros(sharedRelros);
sharedRelros = null;
}
mMainThread.notifyAll();
@@ -115,23 +128,6 @@ public class ChildProcessService extends Service {
return sContext.get();
}
- // Return a new Linker instance. If testing, the Linker needs special setup.
- private Linker getLinker() {
- if (Linker.areLinkerTestsEnabled()) {
- // If testing, set the Linker implementation and the test runner
- // class name to match the one used by the parent.
- assert mLinkerParams != null;
- Linker.setLinkerImplementationForTesting(
- mLinkerParams.mLinkerImplementationForTesting);
- Linker linker = Linker.getInstance();
- linker.setTestRunnerClassNameForTesting(
- mLinkerParams.mTestRunnerClassNameForTesting);
- return linker;
- }
- // Not testing, so return a normal the Linker instantiation.
- return Linker.getInstance();
- }
-
@Override
public void onCreate() {
Log.i(TAG, "Creating new ChildProcessService pid=%d", Process.myPid());
@@ -146,23 +142,23 @@ public class ChildProcessService extends Service {
@SuppressFBWarnings("DM_EXIT")
public void run() {
try {
- // CommandLine must be initialized before others, e.g., Linker.isUsed()
- // may check the command line options.
+ // CommandLine must be initialized before everything else.
synchronized (mMainThread) {
while (mCommandLineParams == null) {
mMainThread.wait();
}
}
CommandLine.init(mCommandLineParams);
- Linker linker = getLinker();
- boolean useLinker = linker.isUsed();
+
+ Linker linker = null;
boolean requestedSharedRelro = false;
- if (useLinker) {
+ if (Linker.isUsed()) {
synchronized (mMainThread) {
while (!mIsBound) {
mMainThread.wait();
}
}
+ linker = getLinker();
if (mLinkerParams.mWaitForSharedRelro) {
requestedSharedRelro = true;
linker.initServiceProcess(mLinkerParams.mBaseLoadAddress);
« no previous file with comments | « content/content_tests.gypi ('k') | content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698