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

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

Issue 611393002: Rationalize and fix chromium android linker histogram recording. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 // Chrome actually uses the renderer code path for all of its child 114 // Chrome actually uses the renderer code path for all of its child
115 // processes such as renderers, plugins, etc. 115 // processes such as renderers, plugins, etc.
116 void InternalInitChildProcess(const std::vector<int>& file_ids, 116 void InternalInitChildProcess(const std::vector<int>& file_ids,
117 const std::vector<int>& file_fds, 117 const std::vector<int>& file_fds,
118 JNIEnv* env, 118 JNIEnv* env,
119 jclass clazz, 119 jclass clazz,
120 jobject context, 120 jobject context,
121 jobject service_in, 121 jobject service_in,
122 jint cpu_count, 122 jint cpu_count,
123 jlong cpu_features) { 123 jlong cpu_features,
124 jboolean use_linker,
125 jboolean load_at_fixed_address_failed) {
124 base::android::ScopedJavaLocalRef<jobject> service(env, service_in); 126 base::android::ScopedJavaLocalRef<jobject> service(env, service_in);
125 127
126 // Set the CPU properties. 128 // Set the CPU properties.
127 android_setCpu(cpu_count, cpu_features); 129 android_setCpu(cpu_count, cpu_features);
128 // Register the file descriptors. 130 // Register the file descriptors.
129 // This includes the IPC channel, the crash dump signals and resource related 131 // This includes the IPC channel, the crash dump signals and resource related
130 // files. 132 // files.
131 DCHECK(file_fds.size() == file_ids.size()); 133 DCHECK(file_fds.size() == file_ids.size());
132 for (size_t i = 0; i < file_ids.size(); ++i) 134 for (size_t i = 0; i < file_ids.size(); ++i)
133 base::GlobalDescriptors::GetInstance()->Set(file_ids[i], file_fds[i]); 135 base::GlobalDescriptors::GetInstance()->Set(file_ids[i], file_fds[i]);
134 136
135 // SurfaceTexturePeerChildImpl implements the SurfaceTextureLookup interface, 137 // SurfaceTexturePeerChildImpl implements the SurfaceTextureLookup interface,
136 // which need to be set before we create a compositor thread that could be 138 // which need to be set before we create a compositor thread that could be
137 // using it to initialize resources. 139 // using it to initialize resources.
138 content::SurfaceTexturePeer::InitInstance( 140 content::SurfaceTexturePeer::InitInstance(
139 new SurfaceTexturePeerChildImpl(service)); 141 new SurfaceTexturePeerChildImpl(service));
140 142
141 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback(env); 143 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback(env);
144
145 // Save any chromium linker histogram value for later recording.
146 if (use_linker) {
147 base::android::RegisterChromiumAndroidLinkerRendererHistogram(
148 load_at_fixed_address_failed);
149 }
142 } 150 }
143 151
144 } // namespace <anonymous> 152 } // namespace <anonymous>
145 153
146 void InitChildProcess(JNIEnv* env, 154 void InitChildProcess(JNIEnv* env,
147 jclass clazz, 155 jclass clazz,
148 jobject context, 156 jobject context,
149 jobject service, 157 jobject service,
150 jintArray j_file_ids, 158 jintArray j_file_ids,
151 jintArray j_file_fds, 159 jintArray j_file_fds,
152 jint cpu_count, 160 jint cpu_count,
153 jlong cpu_features) { 161 jlong cpu_features,
162 jboolean use_linker,
rmcilroy 2014/10/01 12:14:42 nit - used_chromium_linker (and in the Java file)
simonb (inactive) 2014/10/02 15:15:30 Changes to this file reverted entirely as part of
163 jboolean load_at_fixed_address_failed) {
154 std::vector<int> file_ids; 164 std::vector<int> file_ids;
155 std::vector<int> file_fds; 165 std::vector<int> file_fds;
156 JavaIntArrayToIntVector(env, j_file_ids, &file_ids); 166 JavaIntArrayToIntVector(env, j_file_ids, &file_ids);
157 JavaIntArrayToIntVector(env, j_file_fds, &file_fds); 167 JavaIntArrayToIntVector(env, j_file_fds, &file_fds);
158 168
159 InternalInitChildProcess( 169 InternalInitChildProcess(
160 file_ids, file_fds, env, clazz, context, service, 170 file_ids, file_fds, env, clazz, context, service,
161 cpu_count, cpu_features); 171 cpu_count, cpu_features,
172 use_linker, load_at_fixed_address_failed);
162 } 173 }
163 174
164 void ExitChildProcess(JNIEnv* env, jclass clazz) { 175 void ExitChildProcess(JNIEnv* env, jclass clazz) {
165 VLOG(0) << "ChildProcessService: Exiting child process."; 176 VLOG(0) << "ChildProcessService: Exiting child process.";
166 base::android::LibraryLoaderExitHook(); 177 base::android::LibraryLoaderExitHook();
167 _exit(0); 178 _exit(0);
168 } 179 }
169 180
170 bool RegisterChildProcessService(JNIEnv* env) { 181 bool RegisterChildProcessService(JNIEnv* env) {
171 return RegisterNativesImpl(env); 182 return RegisterNativesImpl(env);
172 } 183 }
173 184
174 void ShutdownMainThread(JNIEnv* env, jobject obj) { 185 void ShutdownMainThread(JNIEnv* env, jobject obj) {
175 ChildThread::ShutdownThread(); 186 ChildThread::ShutdownThread();
176 } 187 }
177 188
178 } // namespace content 189 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698