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

Side by Side Diff: content/app/android/child_process_service.cc

Issue 1278823006: Fix a few CHECK_JNI failures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | content/app/android/content_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // The instance of org.chromium.content.app.ChildProcessService. 126 // The instance of org.chromium.content.app.ChildProcessService.
127 base::android::ScopedJavaGlobalRef<jobject> service_; 127 base::android::ScopedJavaGlobalRef<jobject> service_;
128 128
129 DISALLOW_COPY_AND_ASSIGN(SurfaceTextureManagerImpl); 129 DISALLOW_COPY_AND_ASSIGN(SurfaceTextureManagerImpl);
130 }; 130 };
131 131
132 // Chrome actually uses the renderer code path for all of its child 132 // Chrome actually uses the renderer code path for all of its child
133 // processes such as renderers, plugins, etc. 133 // processes such as renderers, plugins, etc.
134 void InternalInitChildProcess(JNIEnv* env, 134 void InternalInitChildProcess(JNIEnv* env,
135 jclass clazz, 135 jclass clazz,
136 jobject context,
137 jobject service_in, 136 jobject service_in,
138 jint cpu_count, 137 jint cpu_count,
139 jlong cpu_features) { 138 jlong cpu_features) {
140 base::android::ScopedJavaLocalRef<jobject> service(env, service_in); 139 base::android::ScopedJavaLocalRef<jobject> service(
140 env, env->NewLocalRef(service_in));
141 141
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 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 jclass clazz,
163 jobject context,
164 jobject service, 163 jobject service,
165 jint cpu_count, 164 jint cpu_count,
166 jlong cpu_features) { 165 jlong cpu_features) {
167 InternalInitChildProcess(env, clazz, context, service, cpu_count, 166 InternalInitChildProcess(env, clazz, service, cpu_count, cpu_features);
168 cpu_features);
169 } 167 }
170 168
171 void ExitChildProcess(JNIEnv* env, jclass clazz) { 169 void ExitChildProcess(JNIEnv* env, jclass clazz) {
172 VLOG(0) << "ChildProcessService: Exiting child process."; 170 VLOG(0) << "ChildProcessService: Exiting child process.";
173 base::android::LibraryLoaderExitHook(); 171 base::android::LibraryLoaderExitHook();
174 _exit(0); 172 _exit(0);
175 } 173 }
176 174
177 bool RegisterChildProcessService(JNIEnv* env) { 175 bool RegisterChildProcessService(JNIEnv* env) {
178 return RegisterNativesImpl(env); 176 return RegisterNativesImpl(env);
179 } 177 }
180 178
181 void ShutdownMainThread(JNIEnv* env, jobject obj) { 179 void ShutdownMainThread(JNIEnv* env, jobject obj) {
182 ChildThreadImpl::ShutdownThread(); 180 ChildThreadImpl::ShutdownThread();
183 } 181 }
184 182
185 } // namespace content 183 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/app/android/content_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698