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

Unified Diff: components/sessions/core/tab_restore_service.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: components/sessions/core/tab_restore_service.cc
diff --git a/components/sessions/core/tab_restore_service.cc b/components/sessions/core/tab_restore_service.cc
index c440faf33279c20c658b88abbe03f02e3e9c3895..1021c37c6677ad454b87e58e3178d17acebe95be 100644
--- a/components/sessions/core/tab_restore_service.cc
+++ b/components/sessions/core/tab_restore_service.cc
@@ -15,71 +15,14 @@ TabRestoreService::TimeFactory::~TimeFactory() {}
// ID of the next Entry.
static SessionID::id_type next_entry_id = 1;
-TabRestoreService::Entry::Entry()
- : id(next_entry_id++),
- type(TAB),
- from_last_session(false) {}
+TabRestoreService::Entry::~Entry() = default;
+TabRestoreService::Entry::Entry(Type type) : id(next_entry_id++), type(type) {}
-TabRestoreService::Entry::Entry(Type type)
- : id(next_entry_id++),
- type(type),
- from_last_session(false) {}
+TabRestoreService::Tab::Tab() : Entry(TAB){};
sky 2016/08/04 16:34:39 '(TAB){};' -> '(TAB) {}'
Sidney San Martín 2016/08/04 17:04:50 Interestingly enough, `git cl format` did this. Sh
sky 2016/08/04 19:09:52 Interesting indeed. Yes, go ahead and file a bug.
Sidney San Martín 2016/08/04 20:17:19 Oh, it's my goof. The semicolon convinces it to re
+TabRestoreService::Tab::~Tab() = default;
-TabRestoreService::Entry::~Entry() {}
-
-// Tab ------------------------------------------------------------------------
-
-TabRestoreService::Tab::Tab()
- : Entry(TAB),
- current_navigation_index(-1),
- browser_id(0),
- tabstrip_index(-1),
- pinned(false) {
-}
-
-TabRestoreService::Tab::Tab(const TabRestoreService::Tab& tab)
- : Entry(tab),
- navigations(tab.navigations),
- current_navigation_index(tab.current_navigation_index),
- browser_id(tab.browser_id),
- tabstrip_index(tab.tabstrip_index),
- pinned(tab.pinned),
- extension_app_id(tab.extension_app_id),
- user_agent_override(tab.user_agent_override) {
- if (tab.platform_data)
- platform_data = tab.platform_data->Clone();
-}
-
-TabRestoreService::Tab::~Tab() {
-}
-
-TabRestoreService::Tab& TabRestoreService::Tab::operator=(
- const TabRestoreService::Tab& tab) {
- id = tab.id;
- type = tab.type;
- timestamp = tab.timestamp;
- from_last_session = tab.from_last_session;
- navigations = tab.navigations;
- current_navigation_index = tab.current_navigation_index;
- browser_id = tab.browser_id;
- tabstrip_index = tab.tabstrip_index;
- pinned = tab.pinned;
- extension_app_id = tab.extension_app_id;
- user_agent_override = tab.user_agent_override;
-
- if (tab.platform_data)
- platform_data = tab.platform_data->Clone();
-
- return *this;
-}
-
-// Window ---------------------------------------------------------------------
-
-TabRestoreService::Window::Window() : Entry(WINDOW), selected_tab_index(-1) {
-}
-
-TabRestoreService::Window::~Window() {
-}
+TabRestoreService::Window::Window() : Entry(WINDOW){};
sky 2016/08/04 16:34:39 Same comment as above here.
+TabRestoreService::Window::~Window() = default;
// TabRestoreService ----------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698