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

Unified Diff: ios/chrome/browser/web/network_activity_indicator_tab_helper.mm

Issue 2585863002: Ensure network activity is stopped on deallocation. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/web/network_activity_indicator_tab_helper.mm
diff --git a/ios/chrome/browser/web/network_activity_indicator_tab_helper.mm b/ios/chrome/browser/web/network_activity_indicator_tab_helper.mm
index 105ac327d258333b6bfed3044ea8d231dad45b9d..7734e77e7d2f7f1e36b03fa1c8d0e0b0869eb359 100644
--- a/ios/chrome/browser/web/network_activity_indicator_tab_helper.mm
+++ b/ios/chrome/browser/web/network_activity_indicator_tab_helper.mm
@@ -25,7 +25,14 @@ NetworkActivityIndicatorTabHelper::NetworkActivityIndicatorTabHelper(
NSString* tab_id)
: web::WebStateObserver(web_state), network_activity_key_([tab_id copy]) {}
-NetworkActivityIndicatorTabHelper::~NetworkActivityIndicatorTabHelper() {}
+NetworkActivityIndicatorTabHelper::~NetworkActivityIndicatorTabHelper() {
+ NetworkActivityIndicatorManager* shared_manager =
+ [NetworkActivityIndicatorManager sharedInstance];
+ // Verifies that there is a network task associated with this instance
+ // before stopping a task, so that this method is idempotent.
+ if ([shared_manager numNetworkTasksForGroup:network_activity_key_])
+ [shared_manager stopNetworkTaskForGroup:network_activity_key_];
+}
void NetworkActivityIndicatorTabHelper::DidStartLoading() {
NetworkActivityIndicatorManager* shared_manager =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698