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

Side by Side Diff: base/android/java/src/org/chromium/base/CpuFeatures.java

Issue 11503013: android: Pass CPU properties from browser to renderer process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
« no previous file with comments | « base/android/cpu_features.cc ('k') | base/base.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.base;
6
7 // The only purpose of this class is to allow sending CPU properties
8 // from the browser process to sandboxed renderer processes. This is
9 // needed because sandboxed processes cannot, on ARM, query the kernel
10 // about the CPU's properties by parsing /proc, so this operation must
11 // be performed in the browser process, and the result passed to
12 // renderer ones.
13 //
14 // For more context, see crbug.com/164154
joth 2012/12/19 19:09:40 nit: linkify.
digit1 2013/01/09 11:26:19 Sure, will do.
15 //
16 // Technically, this is a wrapper around the native NDK cpufeatures
17 // library. The exact CPU features bits are never used in Java so
18 // there is no point in duplicating their definitions here.
19 //
20 @JNINamespace("base::android")
21 public abstract class CpuFeatures {
22 /**
23 * Return the number of CPU Cores on the device.
24 */
25 public static int getCount() {
26 return nativeGetCoreCount();
27 }
28
29 /**
30 * Return the CPU feature mask.
31 * This is a 64-bit integer that corresponds to the CPU's features.
32 * The value is taken directory to
agl 2012/12/19 18:26:36 Comment seems truncated?
digit1 2013/01/09 11:26:19 Yes, I'll update it.
33 */
34 public static long getMask() {
35 return nativeGetCpuFeatures();
36 }
37
38 /**
39 * Set CPU core count and feature mask.
40 * This must be called in sandboxed renderer processes before any
41 * other function from the native library that might depend on the
42 * the CPU count / features.
43 * @param coreCount Number of CPU cores on device.
44 * @param featuresMask CPU features mask.
45 */
46 public static void set(int coreCount, long featuresMask) {
joth 2012/12/19 19:09:40 is this needed? loos like the sandbox process is a
digit1 2013/01/09 11:26:19 Indeed, this is no longer needed.
47 nativeSetCpu(coreCount, featuresMask);
48 }
49
50 private static native int nativeGetCoreCount();
51 private static native long nativeGetCpuFeatures();
52 private static native void nativeSetCpu(int coreCount, long featuresMask);
53 }
OLDNEW
« no previous file with comments | « base/android/cpu_features.cc ('k') | base/base.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698