Commit fc35ffd8 authored by edchin's avatar edchin Committed by Commit Bot

[ios] [recent_tabs] Set imageDataSource before mediator starts observing

Currently, the image data source must be set before the mediator starts updating
its consumer. The mediator will start updating its consumer as soon as it
starts observing sync state, which starts before the view controller has been
presented. Therefore, the imageDataSource will DCHECK since it is being
accessed before it is set.

The order of setting the imageDataSource should not matter. So a bug
was filed for this: crbug.com/845636.

Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I9893493c1f0e2927b9bc6b69bfdea0142f03adab
Reviewed-on: https://chromium-review.googlesource.com/1069590Reviewed-by: default avataredchin <edchin@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560812}
parent a1c6e709
...@@ -66,11 +66,13 @@ ...@@ -66,11 +66,13 @@
// Set the consumer first before calling [self.mediator initObservers] and // Set the consumer first before calling [self.mediator initObservers] and
// then [self.mediator reloadSessions]. // then [self.mediator reloadSessions].
self.mediator.consumer = recentTabsTableViewController; self.mediator.consumer = recentTabsTableViewController;
// TODO(crbug.com/845636) : Currently, the image data source must be set
// before the mediator starts updating its consumer. Fix this so that order of
// calls does not matter.
recentTabsTableViewController.imageDataSource = self.mediator;
recentTabsTableViewController.delegate = self.mediator; recentTabsTableViewController.delegate = self.mediator;
[self.mediator initObservers]; [self.mediator initObservers];
[self.mediator reloadSessions]; [self.mediator reloadSessions];
// Set the datasource for favicons.
recentTabsTableViewController.imageDataSource = self.mediator;
// Present RecentTabsNavigationController. // Present RecentTabsNavigationController.
self.recentTabsNavigationController = [[TableViewNavigationController alloc] self.recentTabsNavigationController = [[TableViewNavigationController alloc]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment