diff options
author | hush@chromium.org <hush@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-23 01:24:18 +0000 |
---|---|---|
committer | hush@chromium.org <hush@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-23 01:24:18 +0000 |
commit | 72d850a207105cb6e647400b4479d318f6ee8072 (patch) | |
tree | 5a1580135a932b4421007198be216e7048f1879a | |
parent | ba8a9357acad351c0037206602e7872bc9bfec12 (diff) | |
download | chromium_src-72d850a207105cb6e647400b4479d318f6ee8072.zip chromium_src-72d850a207105cb6e647400b4479d318f6ee8072.tar.gz chromium_src-72d850a207105cb6e647400b4479d318f6ee8072.tar.bz2 |
Move initTraceEvent to WebView code in Android tree to avoid reflection.
BUG=
Review URL: https://codereview.chromium.org/246443006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265466 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java index b3aa4f8..7044cb7 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java +++ b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java @@ -5,18 +5,13 @@ package org.chromium.android_webview; import android.content.Context; -import android.os.Build; -import android.util.Log; import org.chromium.base.PathUtils; import org.chromium.base.ThreadUtils; -import org.chromium.base.TraceEvent; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.library_loader.ProcessInitException; import org.chromium.content.browser.BrowserStartupController; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; /** * Wrapper for the steps needed to initialize the java and native sides of webview chromium. @@ -34,58 +29,11 @@ public abstract class AwBrowserProcess { PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); try { LibraryLoader.loadNow(); - initTraceEvent(); } catch (ProcessInitException e) { throw new RuntimeException("Cannot load WebView", e); } } - // TODO(benm): Move this function into WebView code in Android tree to avoid reflection. - private static void initTraceEvent() { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return; - - try { - final Class<?> traceClass = Class.forName("android.os.Trace"); - final long traceTagView = traceClass.getField("TRACE_TAG_WEBVIEW").getLong(null); - - final Class<?> systemPropertiesClass = Class.forName("android.os.SystemProperties"); - final Method systemPropertiesGetLongMethod = systemPropertiesClass.getDeclaredMethod( - "getLong", String.class, Long.TYPE); - final Method addChangeCallbackMethod = systemPropertiesClass.getDeclaredMethod( - "addChangeCallback", Runnable.class); - - // Won't reach here if any of the above reflect lookups fail. - addChangeCallbackMethod.invoke(null, new Runnable() { - @Override - public void run() { - try { - long enabledFlags = (Long) systemPropertiesGetLongMethod.invoke( - null, "debug.atrace.tags.enableflags", 0); - TraceEvent.setATraceEnabled((enabledFlags & traceTagView) != 0); - } catch (IllegalArgumentException e) { - Log.e(TAG, "systemPropertyChanged", e); - } catch (IllegalAccessException e) { - Log.e(TAG, "systemPropertyChanged", e); - } catch (InvocationTargetException e) { - Log.e(TAG, "systemPropertyChanged", e); - } - } - }); - } catch (ClassNotFoundException e) { - Log.e(TAG, "initTraceEvent", e); - } catch (NoSuchMethodException e) { - Log.e(TAG, "initTraceEvent", e); - } catch (IllegalArgumentException e) { - Log.e(TAG, "initTraceEvent", e); - } catch (IllegalAccessException e) { - Log.e(TAG, "initTraceEvent", e); - } catch (InvocationTargetException e) { - Log.e(TAG, "initTraceEvent", e); - } catch (NoSuchFieldException e) { - Log.e(TAG, "initTraceEvent", e); - } - } - /** * Starts the chromium browser process running within this process. Creates threads * and performs other per-app resource allocations; must not be called from zygote. |