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

Unified Diff: chrome/browser/download/download_item_model.cc

Issue 2845293004: 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: chrome/browser/download/download_item_model.cc
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc
index fc968b642df410a3c8940fd8cd6a3496ba74e9dd..503527a544c94f722da19fd83213b4a8fc2d0aff 100644
--- a/chrome/browser/download/download_item_model.cc
+++ b/chrome/browser/download/download_item_model.cc
@@ -6,6 +6,7 @@
#include "base/i18n/number_formatting.h"
#include "base/i18n/rtl.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string16.h"
#include "base/strings/sys_string_conversions.h"
@@ -44,6 +45,8 @@ namespace {
// DownloadItem, and the lifetime of the model is shorter than the DownloadItem.
class DownloadItemModelData : public base::SupportsUserData::Data {
public:
+ ~DownloadItemModelData() override {}
+
// Get the DownloadItemModelData object for |download|. Returns NULL if
// there's no model data.
static const DownloadItemModelData* Get(const DownloadItem* download);
@@ -72,7 +75,6 @@ class DownloadItemModelData : public base::SupportsUserData::Data {
private:
DownloadItemModelData();
- ~DownloadItemModelData() override {}
static const char kKey[];
};
@@ -94,7 +96,7 @@ DownloadItemModelData* DownloadItemModelData::GetOrCreate(
if (data == NULL) {
data = new DownloadItemModelData();
data->should_show_in_shelf_ = !download->IsTransient();
- download->SetUserData(kKey, data);
+ download->SetUserData(kKey, base::WrapUnique(data));
}
return data;
}
« no previous file with comments | « chrome/browser/download/download_history.cc ('k') | chrome/browser/download/download_path_reservation_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698