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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/extensions/api/downloads/downloads_api.h" 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 std::unique_ptr<base::ListValue> json_results(new base::ListValue()); 1096 std::unique_ptr<base::ListValue> json_results(new base::ListValue());
1097 for (DownloadManager::DownloadVector::const_iterator it = results.begin(); 1097 for (DownloadManager::DownloadVector::const_iterator it = results.begin();
1098 it != results.end(); ++it) { 1098 it != results.end(); ++it) {
1099 DownloadItem* download_item = *it; 1099 DownloadItem* download_item = *it;
1100 uint32_t download_id = download_item->GetId(); 1100 uint32_t download_id = download_item->GetId();
1101 bool off_record = ((incognito_manager != NULL) && 1101 bool off_record = ((incognito_manager != NULL) &&
1102 (incognito_manager->GetDownload(download_id) != NULL)); 1102 (incognito_manager->GetDownload(download_id) != NULL));
1103 std::unique_ptr<base::DictionaryValue> json_item(DownloadItemToJSON( 1103 std::unique_ptr<base::DictionaryValue> json_item(DownloadItemToJSON(
1104 *it, off_record ? GetProfile()->GetOffTheRecordProfile() 1104 *it, off_record ? GetProfile()->GetOffTheRecordProfile()
1105 : GetProfile()->GetOriginalProfile())); 1105 : GetProfile()->GetOriginalProfile()));
1106 json_results->Append(json_item.release()); 1106 json_results->Append(std::move(json_item));
1107 } 1107 }
1108 SetResult(std::move(json_results)); 1108 SetResult(std::move(json_results));
1109 RecordApiFunctions(DOWNLOADS_FUNCTION_SEARCH); 1109 RecordApiFunctions(DOWNLOADS_FUNCTION_SEARCH);
1110 return true; 1110 return true;
1111 } 1111 }
1112 1112
1113 DownloadsPauseFunction::DownloadsPauseFunction() {} 1113 DownloadsPauseFunction::DownloadsPauseFunction() {}
1114 1114
1115 DownloadsPauseFunction::~DownloadsPauseFunction() {} 1115 DownloadsPauseFunction::~DownloadsPauseFunction() {}
1116 1116
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 return; 1902 return;
1903 base::Time now(base::Time::Now()); 1903 base::Time now(base::Time::Now());
1904 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); 1904 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT();
1905 if (delta <= kFileExistenceRateLimitSeconds) 1905 if (delta <= kFileExistenceRateLimitSeconds)
1906 return; 1906 return;
1907 last_checked_removal_ = now; 1907 last_checked_removal_ = now;
1908 manager->CheckForHistoryFilesRemoval(); 1908 manager->CheckForHistoryFilesRemoval();
1909 } 1909 }
1910 1910
1911 } // namespace extensions 1911 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698