 Chromium Code Reviews
 Chromium Code Reviews Issue 2247143004:
  Remove app context init from LibraryLoader.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 2247143004:
  Remove app context init from LibraryLoader.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java | 
| diff --git a/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java b/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java | 
| index a43219c6a6a8b542b2aecc01f00275b604cbf664..2d096bbb7b1620838f81389feac04779389937f7 100644 | 
| --- a/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java | 
| +++ b/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java | 
| @@ -65,7 +65,7 @@ public class ChildProcessServiceImpl { | 
| // Child library process type. | 
| private int mLibraryProcessType; | 
| - private static AtomicReference<Context> sContext = new AtomicReference<Context>(null); | 
| + private static AtomicReference<Context> sContext = new AtomicReference<>(null); | 
| private boolean mLibraryInitialized = false; | 
| // Becomes true once the service is bound. Access must synchronize around mMainThread. | 
| private boolean mIsBound = false; | 
| @@ -131,10 +131,10 @@ public class ChildProcessServiceImpl { | 
| /** | 
| * Loads Chrome's native libraries and initializes a ChildProcessServiceImpl. | 
| * @param context The application context. | 
| - * @param hostBrowserContext The context of the host browser (i.e. Chrome). | 
| + * @param hostContext The context of the host browser (i.e. Chrome). | 
| 
Ted C
2016/09/28 17:27:46
I would drop browser from the comment as well.
I
 
Peter Wen
2016/09/29 18:41:38
Done.
 | 
| */ | 
| - public void create(final Context context, final Context hostBrowserContext) { | 
| - mHostClassLoader = hostBrowserContext.getClassLoader(); | 
| + public void create(final Context context, final Context hostContext) { | 
| + mHostClassLoader = hostContext.getClassLoader(); | 
| Log.i(TAG, "Creating new ChildProcessService pid=%d", Process.myPid()); | 
| if (sContext.get() != null) { | 
| throw new RuntimeException("Illegal child process reuse."); | 
| @@ -181,7 +181,8 @@ public class ChildProcessServiceImpl { | 
| boolean loadAtFixedAddressFailed = false; | 
| try { | 
| - LibraryLoader.get(mLibraryProcessType).loadNow(hostBrowserContext); | 
| + LibraryLoader.get(mLibraryProcessType) | 
| + .loadNowOverrideApplicationContext(hostContext); | 
| isLoaded = true; | 
| } catch (ProcessInitException e) { | 
| if (requestedSharedRelro) { | 
| @@ -195,7 +196,8 @@ public class ChildProcessServiceImpl { | 
| if (!isLoaded && requestedSharedRelro) { | 
| linker.disableSharedRelros(); | 
| try { | 
| - LibraryLoader.get(mLibraryProcessType).loadNow(hostBrowserContext); | 
| + LibraryLoader.get(mLibraryProcessType) | 
| + .loadNowOverrideApplicationContext(hostContext); | 
| isLoaded = true; | 
| } catch (ProcessInitException e) { | 
| Log.e(TAG, "Failed to load native library on retry", e); |