| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.content.ComponentName; | 7 import android.content.ComponentName; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.pm.ApplicationInfo; | 9 import android.content.pm.ApplicationInfo; |
| 10 import android.content.pm.PackageManager; | 10 import android.content.pm.PackageManager; |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 connection.stop(); | 840 connection.stop(); |
| 841 freeConnection(connection); | 841 freeConnection(connection); |
| 842 } | 842 } |
| 843 | 843 |
| 844 /** | 844 /** |
| 845 * This implementation is used to receive callbacks from the remote service. | 845 * This implementation is used to receive callbacks from the remote service. |
| 846 */ | 846 */ |
| 847 private static IChildProcessCallback createCallback( | 847 private static IChildProcessCallback createCallback( |
| 848 final int childProcessId, final int callbackType) { | 848 final int childProcessId, final int callbackType) { |
| 849 return new IChildProcessCallback.Stub() { | 849 return new IChildProcessCallback.Stub() { |
| 850 /** | |
| 851 * This is called by the remote service regularly to tell us about n
ew values. Note that | |
| 852 * IPC calls are dispatched through a thread pool running in each pr
ocess, so the code | |
| 853 * executing here will NOT be running in our main thread -- so, to u
pdate the UI, we | |
| 854 * need to use a Handler. | |
| 855 */ | |
| 856 @Override | |
| 857 public void establishSurfacePeer( | |
| 858 int pid, Surface surface, int primaryID, int secondaryID) { | |
| 859 // Do not allow a malicious renderer to connect to a producer. T
his is only used | |
| 860 // from stream textures managed by the GPU process. | |
| 861 if (callbackType != CALLBACK_FOR_GPU_PROCESS) { | |
| 862 Log.e(TAG, "Illegal callback for non-GPU process."); | |
| 863 return; | |
| 864 } | |
| 865 | |
| 866 nativeEstablishSurfacePeer(pid, surface, primaryID, secondaryID)
; | |
| 867 } | |
| 868 | |
| 869 @Override | 850 @Override |
| 870 public void forwardSurfaceForSurfaceRequest( | 851 public void forwardSurfaceForSurfaceRequest( |
| 871 UnguessableToken requestToken, Surface surface) { | 852 UnguessableToken requestToken, Surface surface) { |
| 872 // Do not allow a malicious renderer to connect to a producer. T
his is only used | 853 // Do not allow a malicious renderer to connect to a producer. T
his is only used |
| 873 // from stream textures managed by the GPU process. | 854 // from stream textures managed by the GPU process. |
| 874 if (callbackType != CALLBACK_FOR_GPU_PROCESS) { | 855 if (callbackType != CALLBACK_FOR_GPU_PROCESS) { |
| 875 Log.e(TAG, "Illegal callback for non-GPU process."); | 856 Log.e(TAG, "Illegal callback for non-GPU process."); |
| 876 return; | 857 return; |
| 877 } | 858 } |
| 878 | 859 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 try { | 972 try { |
| 992 ((ChildProcessConnectionImpl) sServiceMap.get(pid)).crashServiceForT
esting(); | 973 ((ChildProcessConnectionImpl) sServiceMap.get(pid)).crashServiceForT
esting(); |
| 993 } catch (RemoteException ex) { | 974 } catch (RemoteException ex) { |
| 994 return false; | 975 return false; |
| 995 } | 976 } |
| 996 | 977 |
| 997 return true; | 978 return true; |
| 998 } | 979 } |
| 999 | 980 |
| 1000 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); | 981 private static native void nativeOnChildProcessStarted(long clientContext, i
nt pid); |
| 1001 private static native void nativeEstablishSurfacePeer( | |
| 1002 int pid, Surface surface, int primaryID, int secondaryID); | |
| 1003 private static native void nativeCompleteScopedSurfaceRequest( | 982 private static native void nativeCompleteScopedSurfaceRequest( |
| 1004 UnguessableToken requestToken, Surface surface); | 983 UnguessableToken requestToken, Surface surface); |
| 1005 private static native boolean nativeIsSingleProcess(); | 984 private static native boolean nativeIsSingleProcess(); |
| 1006 private static native Surface nativeGetViewSurface(int surfaceId); | 985 private static native Surface nativeGetViewSurface(int surfaceId); |
| 1007 } | 986 } |
| OLD | NEW |