Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: libadblockplus-android-webview/src/org/adblockplus/libadblockplus/android/webview/AdblockWebView.java

Issue 29671734: Issue 6265 - Create shared AdblockEngine instance in AdblockWebView in background (Closed)
Left Patch Set: @deprecated in javadoc, order Created Jan. 19, 2018, 1:04 p.m.
Right Patch Set: Sergey's comments Created Jan. 22, 2018, 6:19 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « libadblockplus-android-webview/pom.xml ('k') | libadblockplus-android-webviewapp/AndroidManifest.xml » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 { 240 {
241 return; 241 return;
242 } 242 }
243 243
244 final Runnable setRunnable = new Runnable() 244 final Runnable setRunnable = new Runnable()
245 { 245 {
246 @Override 246 @Override
247 public void run() 247 public void run()
248 { 248 {
249 AdblockWebView.this.provider = provider; 249 AdblockWebView.this.provider = provider;
250 AdblockWebView.this.provider.retain(true); // asynchronously 250 if (AdblockWebView.this.provider != null)
251 {
252 AdblockWebView.this.provider.retain(true); // asynchronously
253 }
251 } 254 }
252 }; 255 };
253 256
254 if (this.provider != null) 257 if (this.provider != null)
255 { 258 {
256 // as adblockEngine can be busy with elemhide thread we need to use callba ck 259 // as adblockEngine can be busy with elemhide thread we need to use callba ck
257 this.dispose(setRunnable); 260 this.dispose(setRunnable);
258 } 261 }
259 else 262 else
260 { 263 {
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 w("elemHideThread set to null"); 1077 w("elemHideThread set to null");
1075 elemHideThread = null; 1078 elemHideThread = null;
1076 } 1079 }
1077 } 1080 }
1078 }; 1081 };
1079 1082
1080 private void initAbpLoading() 1083 private void initAbpLoading()
1081 { 1084 {
1082 getSettings().setJavaScriptEnabled(true); 1085 getSettings().setJavaScriptEnabled(true);
1083 buildInjectJs(); 1086 buildInjectJs();
1084 initProvider(); 1087 ensureProvider();
1085 } 1088 }
1086 1089
1087 private void initProvider() 1090 private void ensureProvider()
1088 { 1091 {
1089 // if AdblockWebView works as drop-in replacement for WebView 'provider' is not set. 1092 // if AdblockWebView works as drop-in replacement for WebView 'provider' is not set.
1090 // Thus AdblockWebView is using SingleInstanceEngineProvider instance 1093 // Thus AdblockWebView is using SingleInstanceEngineProvider instance
1091 if (provider == null) 1094 if (provider == null)
1092 { 1095 {
1093 setProvider(new SingleInstanceEngineProvider( 1096 setProvider(new SingleInstanceEngineProvider(
1094 getContext(), AdblockEngine.BASE_PATH_DIRECTORY, debugMode)); 1097 getContext(), AdblockEngine.BASE_PATH_DIRECTORY, debugMode));
1095 } 1098 }
1096 } 1099 }
1097 1100
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 w("Busy with elemhide selectors, delayed disposing scheduled"); 1428 w("Busy with elemhide selectors, delayed disposing scheduled");
1426 elemHideThread.setFinishedRunnable(disposeRunnable); 1429 elemHideThread.setFinishedRunnable(disposeRunnable);
1427 } 1430 }
1428 else 1431 else
1429 { 1432 {
1430 disposeRunnable.run(); 1433 disposeRunnable.run();
1431 } 1434 }
1432 } 1435 }
1433 } 1436 }
1434 } 1437 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld