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

Unified Diff: chrome/browser/ui/views/frame/global_menu_bar_x11.cc

Issue 2200993004: Make TabRestoreService::Entry noncopyable and fix up surrounding code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tab-test-cleanup
Patch Set: Eliminate a use-after-free, Windows build fix Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/global_menu_bar_x11.cc
diff --git a/chrome/browser/ui/views/frame/global_menu_bar_x11.cc b/chrome/browser/ui/views/frame/global_menu_bar_x11.cc
index 6b9f3be6663f1fd385918f8b0f79c87ad0d05a00..51eb417e9080f755d056d7c03c86becba69abd0d 100644
--- a/chrome/browser/ui/views/frame/global_menu_bar_x11.cc
+++ b/chrome/browser/ui/views/frame/global_menu_bar_x11.cc
@@ -751,12 +751,12 @@ void GlobalMenuBarX11::TabRestoreServiceChanged(
for (sessions::TabRestoreService::Entries::const_iterator it =
entries.begin();
it != entries.end() && added_count < kRecentlyClosedCount; ++it) {
- sessions::TabRestoreService::Entry* entry = *it;
+ sessions::TabRestoreService::Entry* entry = it->get();
if (entry->type == sessions::TabRestoreService::WINDOW) {
sessions::TabRestoreService::Window* entry_win =
static_cast<sessions::TabRestoreService::Window*>(entry);
- std::vector<sessions::TabRestoreService::Tab>& tabs = entry_win->tabs;
+ auto& tabs = entry_win->tabs;
if (tabs.empty())
continue;
@@ -792,10 +792,8 @@ void GlobalMenuBarX11::TabRestoreServiceChanged(
// Loop over the window's tabs and add them to the submenu.
int subindex = 2;
- std::vector<sessions::TabRestoreService::Tab>::const_iterator iter;
- for (iter = tabs.begin(); iter != tabs.end(); ++iter) {
- sessions::TabRestoreService::Tab tab = *iter;
- HistoryItem* tab_item = HistoryItemForTab(tab);
+ for (const auto& tab : tabs) {
+ HistoryItem* tab_item = HistoryItemForTab(*tab);
item->tabs.push_back(tab_item);
AddHistoryItemToMenu(tab_item,
parent_item,

Powered by Google App Engine
This is Rietveld 408576698