Add DWC to TabSwitcherItem
Light TabSwitcherItems (i.e. only created via a WebStateID) should not
be asked to fetch a snapshot or favicon (outside of tests).
To make sure we don't have such instances, I add DumpWithoutCrash calls
that we'll monitor via crbug.com/331159004 and remove in a future
milestone if all goes well.
Bug: 331158823
Change-Id: I2eca19605ac50fb74502cce019982425ba161e61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5391306
Commit-Queue: Louis Romero <lpromero@google.com>
Auto-Submit: Louis Romero <lpromero@google.com>
Reviewed-by: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1277686}
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_switcher_item.mm b/ios/chrome/browser/ui/tab_switcher/tab_switcher_item.mm
index 70975de..5d423dc 100644
--- a/ios/chrome/browser/ui/tab_switcher/tab_switcher_item.mm
+++ b/ios/chrome/browser/ui/tab_switcher/tab_switcher_item.mm
@@ -5,6 +5,7 @@
#import "ios/chrome/browser/ui/tab_switcher/tab_switcher_item.h"
#import "base/check.h"
+#import "base/debug/dump_without_crashing.h"
#import "ios/web/public/web_state_id.h"
#import "url/gurl.h"
@@ -31,11 +32,21 @@
- (void)fetchFavicon:(TabSwitcherImageFetchingCompletionBlock)completion {
// Subclasses should override this method. It is OK not to call super.
completion(self, nil);
+ // This should not be called in production, as only real
+ // WebStateTabSwitcherItem should be asked to fetch a favicon.
+ // TODO(crbug.com/331159004): Remove in a later milestone if we don't receive
+ // any.
+ base::debug::DumpWithoutCrashing();
}
- (void)fetchSnapshot:(TabSwitcherImageFetchingCompletionBlock)completion {
// Subclasses should override this method. It is OK not to call super.
completion(self, nil);
+ // This should not be called in production, as only real
+ // WebStateTabSwitcherItem should be asked to fetch a snapshot.
+ // TODO(crbug.com/331159004): Remove in a later milestone if we don't receive
+ // any.
+ base::debug::DumpWithoutCrashing();
}
- (void)prefetchSnapshot {