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

Side by Side Diff: content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java

Issue 2684433003: Files required by a service now listed in manifest. (Closed)
Patch Set: Addressed @boliu and @jam's comments. Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.app; 5 package org.chromium.content.app;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.Intent; 8 import android.content.Intent;
9 import android.graphics.SurfaceTexture; 9 import android.graphics.SurfaceTexture;
10 import android.os.Binder; 10 import android.os.Binder;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 .registerRendererProcessHistogram(requestedSharedRel ro, 253 .registerRendererProcessHistogram(requestedSharedRel ro,
254 loadAtFixedAddressFailed); 254 loadAtFixedAddressFailed);
255 LibraryLoader.get(mLibraryProcessType).initialize(); 255 LibraryLoader.get(mLibraryProcessType).initialize();
256 synchronized (mMainThread) { 256 synchronized (mMainThread) {
257 mLibraryInitialized = true; 257 mLibraryInitialized = true;
258 mMainThread.notifyAll(); 258 mMainThread.notifyAll();
259 while (mFdInfos == null) { 259 while (mFdInfos == null) {
260 mMainThread.wait(); 260 mMainThread.wait();
261 } 261 }
262 } 262 }
263 for (FileDescriptorInfo fdInfo : mFdInfos) { 263
264 nativeRegisterGlobalFileDescriptor( 264 String sharedFilesValue = CommandLine.getInstance().getSwitc hValue(
boliu 2017/02/10 21:33:03 delete this, seems like don't need to copy the swi
Jay Civelli 2017/02/13 18:48:25 Done.
265 fdInfo.mId, fdInfo.mFd.detachFd(), fdInfo.mOffse t, fdInfo.mSize); 265 ContentSwitches.SHARED_FILES, null);
266
267 int[] fileIds = new int[mFdInfos.length];
268 int[] fds = new int[mFdInfos.length];
269 long[] regionOffsets = new long[mFdInfos.length];
270 long[] regionSizes = new long[mFdInfos.length];
271 for (int i = 0; i < mFdInfos.length; i++) {
272 FileDescriptorInfo fdInfo = mFdInfos[i];
273 fileIds[i] = fdInfo.mId;
274 fds[i] = fdInfo.mFd.detachFd();
275 regionOffsets[i] = fdInfo.mOffset;
276 regionSizes[i] = fdInfo.mSize;
266 } 277 }
278 nativeRegisterFileDescriptors(fileIds, fds, regionOffsets, r egionSizes);
267 nativeInitChildProcessImpl(ChildProcessServiceImpl.this, mCp uCount, 279 nativeInitChildProcessImpl(ChildProcessServiceImpl.this, mCp uCount,
268 mCpuFeatures); 280 mCpuFeatures);
269 if (mActivitySemaphore.tryAcquire()) { 281 if (mActivitySemaphore.tryAcquire()) {
270 ContentMain.start(); 282 ContentMain.start();
271 nativeExitChildProcess(); 283 nativeExitChildProcess();
272 } 284 }
273 } catch (InterruptedException e) { 285 } catch (InterruptedException e) {
274 Log.w(TAG, "%s startup failed: %s", MAIN_THREAD_NAME, e); 286 Log.w(TAG, "%s startup failed: %s", MAIN_THREAD_NAME, e);
275 } catch (ProcessInitException e) { 287 } catch (ProcessInitException e) {
276 Log.w(TAG, "%s startup failed: %s", MAIN_THREAD_NAME, e); 288 Log.w(TAG, "%s startup failed: %s", MAIN_THREAD_NAME, e);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 try { 406 try {
395 SurfaceWrapper wrapper = mCallback.getViewSurface(surfaceId); 407 SurfaceWrapper wrapper = mCallback.getViewSurface(surfaceId);
396 return wrapper != null ? wrapper.getSurface() : null; 408 return wrapper != null ? wrapper.getSurface() : null;
397 } catch (RemoteException e) { 409 } catch (RemoteException e) {
398 Log.e(TAG, "Unable to call getViewSurface: %s", e); 410 Log.e(TAG, "Unable to call getViewSurface: %s", e);
399 return null; 411 return null;
400 } 412 }
401 } 413 }
402 414
403 /** 415 /**
404 * Helper for registering FileDescriptorInfo objects with GlobalFileDescript ors. 416 * Helper for registering FileDescriptorInfo objects with GlobalFileDescript ors or
417 * FileDescriptorStore.
405 * This includes the IPC channel, the crash dump signals and resource relate d 418 * This includes the IPC channel, the crash dump signals and resource relate d
406 * files. 419 * files.
407 */ 420 */
408 private static native void nativeRegisterGlobalFileDescriptor( 421 private static native void nativeRegisterFileDescriptors(
409 int id, int fd, long offset, long size); 422 int[] id, int[] fd, long[] offset, long[] size);
410 423
411 /** 424 /**
412 * The main entry point for a child process. This should be called from a ne w thread since 425 * The main entry point for a child process. This should be called from a ne w thread since
413 * it will not return until the child process exits. See child_process_servi ce.{h,cc} 426 * it will not return until the child process exits. See child_process_servi ce.{h,cc}
414 * 427 *
415 * @param serviceImpl The current ChildProcessServiceImpl object. 428 * @param serviceImpl The current ChildProcessServiceImpl object.
416 * renderer. 429 * renderer.
417 */ 430 */
418 private static native void nativeInitChildProcessImpl( 431 private static native void nativeInitChildProcessImpl(
419 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures) ; 432 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures) ;
420 433
421 /** 434 /**
422 * Force the child process to exit. 435 * Force the child process to exit.
423 */ 436 */
424 private static native void nativeExitChildProcess(); 437 private static native void nativeExitChildProcess();
425 438
426 private native void nativeShutdownMainThread(); 439 private native void nativeShutdownMainThread();
427 } 440 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698