diff options
author | Torne (Richard Coles) <torne@google.com> | 2014-08-13 16:28:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-12 23:14:49 +0000 |
commit | 4f82d40e9fcc95d10fdc38aa86b86b53876a02c9 (patch) | |
tree | 4f7d9190876379129e1ef08ebd9b977cff64953c /core/java/android/webkit | |
parent | b369ff7b389e1032b0200c2b5564e85532e05a16 (diff) | |
parent | 3822882b32d9b1b803aaff9b657a91d680f1d0f9 (diff) | |
download | frameworks_base-4f82d40e9fcc95d10fdc38aa86b86b53876a02c9.zip frameworks_base-4f82d40e9fcc95d10fdc38aa86b86b53876a02c9.tar.gz frameworks_base-4f82d40e9fcc95d10fdc38aa86b86b53876a02c9.tar.bz2 |
Merge "Add trace events to WebView startup." into lmp-dev
Diffstat (limited to 'core/java/android/webkit')
-rw-r--r-- | core/java/android/webkit/WebViewFactory.java | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java index 23894ee..ec589a5 100644 --- a/core/java/android/webkit/WebViewFactory.java +++ b/core/java/android/webkit/WebViewFactory.java @@ -29,6 +29,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.StrictMode; import android.os.SystemProperties; +import android.os.Trace; import android.text.TextUtils; import android.util.AndroidRuntimeException; import android.util.Log; @@ -83,26 +84,38 @@ public final class WebViewFactory { // us honest and minimize usage of WebView internals when binding the proxy. if (sProviderInstance != null) return sProviderInstance; - loadNativeLibrary(); - - Class<WebViewFactoryProvider> providerClass; + Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW, "WebViewFactory.getProvider()"); try { - providerClass = getFactoryClass(); - } catch (ClassNotFoundException e) { - Log.e(LOGTAG, "error loading provider", e); - throw new AndroidRuntimeException(e); - } + Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW, "WebViewFactory.loadNativeLibrary()"); + loadNativeLibrary(); + Trace.traceEnd(Trace.TRACE_TAG_WEBVIEW); - StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); - try { - sProviderInstance = providerClass.newInstance(); - if (DEBUG) Log.v(LOGTAG, "Loaded provider: " + sProviderInstance); - return sProviderInstance; - } catch (Exception e) { - Log.e(LOGTAG, "error instantiating provider", e); - throw new AndroidRuntimeException(e); + Class<WebViewFactoryProvider> providerClass; + Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW, "WebViewFactory.getFactoryClass()"); + try { + providerClass = getFactoryClass(); + } catch (ClassNotFoundException e) { + Log.e(LOGTAG, "error loading provider", e); + throw new AndroidRuntimeException(e); + } finally { + Trace.traceEnd(Trace.TRACE_TAG_WEBVIEW); + } + + StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); + Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW, "providerClass.newInstance()"); + try { + sProviderInstance = providerClass.newInstance(); + if (DEBUG) Log.v(LOGTAG, "Loaded provider: " + sProviderInstance); + return sProviderInstance; + } catch (Exception e) { + Log.e(LOGTAG, "error instantiating provider", e); + throw new AndroidRuntimeException(e); + } finally { + Trace.traceEnd(Trace.TRACE_TAG_WEBVIEW); + StrictMode.setThreadPolicy(oldPolicy); + } } finally { - StrictMode.setThreadPolicy(oldPolicy); + Trace.traceEnd(Trace.TRACE_TAG_WEBVIEW); } } } @@ -122,8 +135,13 @@ public final class WebViewFactory { initialApplication.getAssets().addAssetPath( webViewContext.getApplicationInfo().sourceDir); ClassLoader clazzLoader = webViewContext.getClassLoader(); - return (Class<WebViewFactoryProvider>) Class.forName(CHROMIUM_WEBVIEW_FACTORY, true, - clazzLoader); + Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW, "Class.forName()"); + try { + return (Class<WebViewFactoryProvider>) Class.forName(CHROMIUM_WEBVIEW_FACTORY, true, + clazzLoader); + } finally { + Trace.traceEnd(Trace.TRACE_TAG_WEBVIEW); + } } catch (PackageManager.NameNotFoundException e) { // If the package doesn't exist, then try loading the null WebView instead. // If that succeeds, then this is a device without WebView support; if it fails then |