| OLD | NEW |
| 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 #include "content/app/android/child_process_service.h" | 5 #include "content/app/android/child_process_service.h" |
| 6 | 6 |
| 7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
| 8 #include <cpu-features.h> | 8 #include <cpu-features.h> |
| 9 | 9 |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Set the CPU properties. | 142 // Set the CPU properties. |
| 143 android_setCpu(cpu_count, cpu_features); | 143 android_setCpu(cpu_count, cpu_features); |
| 144 SurfaceTextureManager::SetInstance(new SurfaceTextureManagerImpl(service)); | 144 SurfaceTextureManager::SetInstance(new SurfaceTextureManagerImpl(service)); |
| 145 | 145 |
| 146 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback(env); | 146 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback(env); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace <anonymous> | 149 } // namespace <anonymous> |
| 150 | 150 |
| 151 void RegisterGlobalFileDescriptor(JNIEnv* env, | 151 void RegisterGlobalFileDescriptor(JNIEnv* env, |
| 152 jclass clazz, | 152 const JavaParamRef<jclass>& clazz, |
| 153 jint id, | 153 jint id, |
| 154 jint fd, | 154 jint fd, |
| 155 jlong offset, | 155 jlong offset, |
| 156 jlong size) { | 156 jlong size) { |
| 157 base::MemoryMappedFile::Region region = {offset, size}; | 157 base::MemoryMappedFile::Region region = {offset, size}; |
| 158 base::GlobalDescriptors::GetInstance()->Set(id, fd, region); | 158 base::GlobalDescriptors::GetInstance()->Set(id, fd, region); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void InitChildProcess(JNIEnv* env, | 161 void InitChildProcess(JNIEnv* env, |
| 162 jclass clazz, | 162 const JavaParamRef<jclass>& clazz, |
| 163 jobject service, | 163 const JavaParamRef<jobject>& service, |
| 164 jint cpu_count, | 164 jint cpu_count, |
| 165 jlong cpu_features) { | 165 jlong cpu_features) { |
| 166 InternalInitChildProcess(env, clazz, service, cpu_count, cpu_features); | 166 InternalInitChildProcess(env, clazz, service, cpu_count, cpu_features); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void ExitChildProcess(JNIEnv* env, jclass clazz) { | 169 void ExitChildProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
| 170 VLOG(0) << "ChildProcessService: Exiting child process."; | 170 VLOG(0) << "ChildProcessService: Exiting child process."; |
| 171 base::android::LibraryLoaderExitHook(); | 171 base::android::LibraryLoaderExitHook(); |
| 172 _exit(0); | 172 _exit(0); |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool RegisterChildProcessService(JNIEnv* env) { | 175 bool RegisterChildProcessService(JNIEnv* env) { |
| 176 return RegisterNativesImpl(env); | 176 return RegisterNativesImpl(env); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void ShutdownMainThread(JNIEnv* env, jobject obj) { | 179 void ShutdownMainThread(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 180 ChildThreadImpl::ShutdownThread(); | 180 ChildThreadImpl::ShutdownThread(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace content | 183 } // namespace content |
| OLD | NEW |