/** * Clears the resource cache. Note that the cache is per-application, so * this will clear the cache for all WebViews used. * * @param includeDiskFiles if false, only the RAM cache is cleared */ publicvoidclearCache(boolean includeDiskFiles){ checkThread(); mProvider.clearCache(includeDiskFiles); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
privatevoidcheckThread(){ // Ignore mWebViewThread == null because this can be called during in the super class // constructor, before this class's own constructor has even started. if (mWebViewThread != null && Looper.myLooper() != mWebViewThread) { Throwable throwable = new Throwable( "A WebView method was called on thread '" + Thread.currentThread().getName() + "'. " + "All WebView methods must be called on the same thread. " + "(Expected Looper " + mWebViewThread + " called on " + Looper.myLooper() + ", FYI main Looper is " + Looper.getMainLooper() + ")"); Log.w(LOGTAG, Log.getStackTraceString(throwable)); StrictMode.onWebViewMethodCalledOnWrongThread(throwable);
if (sEnforceThreadChecking) { thrownew RuntimeException(throwable); } } }
/** * Clears the resource cache. Note that the cache is per-application, so this will clear the * cache for all WebViews used. * * @param includeDiskFiles if false, only the RAM cache is cleared */ publicvoidclearCache(boolean includeDiskFiles){ if (mNativeAwContents == 0) return; nativeClearCache(mNativeAwContents, includeDiskFiles); }