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

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: Synced 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 int[] fileIds = new int[mFdInfos.length];
265 fdInfo.mId, fdInfo.mFd.detachFd(), fdInfo.mOffse t, fdInfo.mSize); 265 int[] fds = new int[mFdInfos.length];
266 long[] regionOffsets = new long[mFdInfos.length];
267 long[] regionSizes = new long[mFdInfos.length];
268 for (int i = 0; i < mFdInfos.length; i++) {
269 FileDescriptorInfo fdInfo = mFdInfos[i];
270 fileIds[i] = fdInfo.mId;
271 fds[i] = fdInfo.mFd.detachFd();
272 regionOffsets[i] = fdInfo.mOffset;
273 regionSizes[i] = fdInfo.mSize;
266 } 274 }
275 nativeRegisterFileDescriptors(fileIds, fds, regionOffsets, r egionSizes);
267 nativeInitChildProcessImpl(ChildProcessServiceImpl.this, mCp uCount, 276 nativeInitChildProcessImpl(ChildProcessServiceImpl.this, mCp uCount,
268 mCpuFeatures); 277 mCpuFeatures);
269 if (mActivitySemaphore.tryAcquire()) { 278 if (mActivitySemaphore.tryAcquire()) {
270 ContentMain.start(); 279 ContentMain.start();
271 nativeExitChildProcess(); 280 nativeExitChildProcess();
272 } 281 }
273 } catch (InterruptedException e) { 282 } catch (InterruptedException e) {
274 Log.w(TAG, "%s startup failed: %s", MAIN_THREAD_NAME, e); 283 Log.w(TAG, "%s startup failed: %s", MAIN_THREAD_NAME, e);
275 } catch (ProcessInitException e) { 284 } catch (ProcessInitException e) {
276 Log.w(TAG, "%s startup failed: %s", MAIN_THREAD_NAME, e); 285 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 { 403 try {
395 SurfaceWrapper wrapper = mCallback.getViewSurface(surfaceId); 404 SurfaceWrapper wrapper = mCallback.getViewSurface(surfaceId);
396 return wrapper != null ? wrapper.getSurface() : null; 405 return wrapper != null ? wrapper.getSurface() : null;
397 } catch (RemoteException e) { 406 } catch (RemoteException e) {
398 Log.e(TAG, "Unable to call getViewSurface: %s", e); 407 Log.e(TAG, "Unable to call getViewSurface: %s", e);
399 return null; 408 return null;
400 } 409 }
401 } 410 }
402 411
403 /** 412 /**
404 * Helper for registering FileDescriptorInfo objects with GlobalFileDescript ors. 413 * Helper for registering FileDescriptorInfo objects with GlobalFileDescript ors or
414 * FileDescriptorStore.
405 * This includes the IPC channel, the crash dump signals and resource relate d 415 * This includes the IPC channel, the crash dump signals and resource relate d
406 * files. 416 * files.
407 */ 417 */
408 private static native void nativeRegisterGlobalFileDescriptor( 418 private static native void nativeRegisterFileDescriptors(
409 int id, int fd, long offset, long size); 419 int[] id, int[] fd, long[] offset, long[] size);
410 420
411 /** 421 /**
412 * The main entry point for a child process. This should be called from a ne w thread since 422 * 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} 423 * it will not return until the child process exits. See child_process_servi ce.{h,cc}
414 * 424 *
415 * @param serviceImpl The current ChildProcessServiceImpl object. 425 * @param serviceImpl The current ChildProcessServiceImpl object.
416 * renderer. 426 * renderer.
417 */ 427 */
418 private static native void nativeInitChildProcessImpl( 428 private static native void nativeInitChildProcessImpl(
419 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures) ; 429 ChildProcessServiceImpl serviceImpl, int cpuCount, long cpuFeatures) ;
420 430
421 /** 431 /**
422 * Force the child process to exit. 432 * Force the child process to exit.
423 */ 433 */
424 private static native void nativeExitChildProcess(); 434 private static native void nativeExitChildProcess();
425 435
426 private native void nativeShutdownMainThread(); 436 private native void nativeShutdownMainThread();
427 } 437 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698