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

Unified Diff: ios/chrome/browser/tabs/tab_model_list.mm

Issue 2853443002: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: Created 3 years, 8 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: ios/chrome/browser/tabs/tab_model_list.mm
diff --git a/ios/chrome/browser/tabs/tab_model_list.mm b/ios/chrome/browser/tabs/tab_model_list.mm
index eba1a08aa3b647abb4f18687a63e17ef8823d0d3..a50f5c2322cd2b62b61135f44f5b11b54cd02d67 100644
--- a/ios/chrome/browser/tabs/tab_model_list.mm
+++ b/ios/chrome/browser/tabs/tab_model_list.mm
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/supports_user_data.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
@@ -54,10 +55,9 @@ TabModelList* TabModelList::GetForBrowserState(
TabModelList* tab_model_list =
static_cast<TabModelList*>(browser_state->GetUserData(&kTabModelListKey));
if (!tab_model_list && create) {
- // The ownership of TabModelList is transfered to base::SupportsUserData
- // via the SetUserData call (should take a std::unique_ptr<>).
tab_model_list = new TabModelList;
- browser_state->SetUserData(&kTabModelListKey, tab_model_list);
+ browser_state->SetUserData(&kTabModelListKey,
+ base::WrapUnique(tab_model_list));
}
return tab_model_list;
}

Powered by Google App Engine
This is Rietveld 408576698