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

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

Issue 11567061: Throw exception when initialization failed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.app.Service; 7 import android.app.Service;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.graphics.SurfaceTexture; 10 import android.graphics.SurfaceTexture;
11 import android.os.Bundle; 11 import android.os.Bundle;
12 import android.os.IBinder; 12 import android.os.IBinder;
13 import android.os.ParcelFileDescriptor; 13 import android.os.ParcelFileDescriptor;
14 import android.os.Process; 14 import android.os.Process;
15 import android.os.RemoteException; 15 import android.os.RemoteException;
16 import android.util.Log; 16 import android.util.Log;
17 import android.view.Surface; 17 import android.view.Surface;
18 18
19 import java.util.ArrayList; 19 import java.util.ArrayList;
20 20
21 import org.chromium.base.CalledByNative; 21 import org.chromium.base.CalledByNative;
22 import org.chromium.base.JNINamespace; 22 import org.chromium.base.JNINamespace;
23 import org.chromium.content.app.ContentMain; 23 import org.chromium.content.app.ContentMain;
24 import org.chromium.content.browser.SandboxedProcessConnection; 24 import org.chromium.content.browser.SandboxedProcessConnection;
25 import org.chromium.content.common.ISandboxedProcessCallback; 25 import org.chromium.content.common.ISandboxedProcessCallback;
26 import org.chromium.content.common.ISandboxedProcessService; 26 import org.chromium.content.common.ISandboxedProcessService;
27 import org.chromium.content.common.ProcessInitException;
27 import org.chromium.content.common.SurfaceCallback; 28 import org.chromium.content.common.SurfaceCallback;
28 29
29 /** 30 /**
30 * This is the base class for sandboxed services; the SandboxedProcessService0, 1.. etc 31 * This is the base class for sandboxed services; the SandboxedProcessService0, 1.. etc
31 * subclasses provide the concrete service entry points, to enable the browser t o connect 32 * subclasses provide the concrete service entry points, to enable the browser t o connect
32 * to more than one distinct process (i.e. one process per service number, up to limit of N). 33 * to more than one distinct process (i.e. one process per service number, up to limit of N).
33 * The embedding application must declare these service instances in the applica tion section 34 * The embedding application must declare these service instances in the applica tion section
34 * of its AndroidManifest.xml, for example with N entries of the form:- 35 * of its AndroidManifest.xml, for example with N entries of the form:-
35 * <service android:name="org.chromium.content.app.SandboxedProcessServiceX" 36 * <service android:name="org.chromium.content.app.SandboxedProcessServiceX"
36 * android:process=":sandboxed_processX" /> 37 * android:process=":sandboxed_processX" />
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 fileFds[i] = mFileFds.get(i).detachFd(); 147 fileFds[i] = mFileFds.get(i).detachFd();
147 } 148 }
148 ContentMain.initApplicationContext(sContext.getApplicationCo ntext()); 149 ContentMain.initApplicationContext(sContext.getApplicationCo ntext());
149 nativeInitSandboxedProcess(sContext.getApplicationContext(), 150 nativeInitSandboxedProcess(sContext.getApplicationContext(),
150 SandboxedProcessService.this, fileIds, fileFds, 151 SandboxedProcessService.this, fileIds, fileFds,
151 mCpuCount, mCpuFeatures); 152 mCpuCount, mCpuFeatures);
152 ContentMain.start(); 153 ContentMain.start();
153 nativeExitSandboxedProcess(); 154 nativeExitSandboxedProcess();
154 } catch (InterruptedException e) { 155 } catch (InterruptedException e) {
155 Log.w(TAG, MAIN_THREAD_NAME + " startup failed: " + e); 156 Log.w(TAG, MAIN_THREAD_NAME + " startup failed: " + e);
157 } catch (ProcessInitException e) {
158 Log.w(TAG, MAIN_THREAD_NAME + " startup failed: " + e);
156 } 159 }
157 } 160 }
158 }, MAIN_THREAD_NAME); 161 }, MAIN_THREAD_NAME);
159 mSandboxMainThread.start(); 162 mSandboxMainThread.start();
160 } 163 }
161 164
162 @Override 165 @Override
163 public void onDestroy() { 166 public void onDestroy() {
164 Log.i(TAG, "Destroying SandboxedProcessService pid=" + Process.myPid()); 167 Log.i(TAG, "Destroying SandboxedProcessService pid=" + Process.myPid());
165 super.onDestroy(); 168 super.onDestroy();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 SandboxedProcessService service, int[] extraFileIds, int[] extraFile Fds, 261 SandboxedProcessService service, int[] extraFileIds, int[] extraFile Fds,
259 int cpuCount, long cpuFeatures); 262 int cpuCount, long cpuFeatures);
260 263
261 /** 264 /**
262 * Force the sandboxed process to exit. 265 * Force the sandboxed process to exit.
263 */ 266 */
264 private static native void nativeExitSandboxedProcess(); 267 private static native void nativeExitSandboxedProcess();
265 268
266 private native void nativeShutdownSandboxMainThread(); 269 private native void nativeShutdownSandboxMainThread();
267 } 270 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698