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

Side by Side Diff: ios/clean/chrome/browser/ui/tab_collection/tab_collection_mediator.mm

Issue 2936563002: [clean ios] Fix TabCollectionMediator disconnect. (Closed)
Patch Set: Created 3 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/clean/chrome/browser/ui/tab_collection/tab_collection_mediator.h" 5 #import "ios/clean/chrome/browser/ui/tab_collection/tab_collection_mediator.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/scoped_observer.h" 8 #include "base/scoped_observer.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #import "ios/chrome/browser/web_state_list/web_state_list.h" 10 #import "ios/chrome/browser/web_state_list/web_state_list.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 - (void)dealloc { 44 - (void)dealloc {
45 [self disconnect]; 45 [self disconnect];
46 } 46 }
47 47
48 #pragma mark - Public 48 #pragma mark - Public
49 49
50 - (void)disconnect { 50 - (void)disconnect {
51 _webStateList = nullptr; 51 _webStateList = nullptr;
52 _webStateObserver.reset(); 52 _scopedWebStateListObserver->RemoveAll();
sdefresne 2017/06/12 09:48:07 I don't understand the comment that ScopedObserver
marq (ping after 24h) 2017/06/13 08:18:53 Yeah, brain fart on my part. Does it make sense t
sdefresne 2017/06/13 09:00:27 WebStateObserver is a weird observer that auto-unr
53 } 53 }
54 54
55 #pragma mark - Properties 55 #pragma mark - Properties
56 56
57 - (void)setWebStateList:(WebStateList*)webStateList { 57 - (void)setWebStateList:(WebStateList*)webStateList {
58 DCHECK(webStateList); 58 DCHECK(webStateList);
59 _scopedWebStateListObserver->RemoveAll(); 59 _scopedWebStateListObserver->RemoveAll();
60 _webStateList = webStateList; 60 _webStateList = webStateList;
61 _scopedWebStateListObserver->Add(_webStateList); 61 _scopedWebStateListObserver->Add(_webStateList);
62 _webStateObserver = base::MakeUnique<web::WebStateObserverBridge>( 62 _webStateObserver = base::MakeUnique<web::WebStateObserverBridge>(
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 - (void)populateConsumerItems { 167 - (void)populateConsumerItems {
168 if (self.consumer && self.webStateList) { 168 if (self.consumer && self.webStateList) {
169 [self.consumer 169 [self.consumer
170 populateItems:[self 170 populateItems:[self
171 tabCollectionItemsFromWebStateList:self.webStateList] 171 tabCollectionItemsFromWebStateList:self.webStateList]
172 selectedIndex:self.webStateList->active_index()]; 172 selectedIndex:self.webStateList->active_index()];
173 } 173 }
174 } 174 }
175 175
176 @end 176 @end
OLDNEW
« 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