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

Side by Side Diff: extensions/browser/updater/extension_downloader.cc

Issue 2294653002: Some linked_ptr -> unique_ptr conversion in extensions/browser. (Closed)
Patch Set: address comments Created 4 years, 3 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 "extensions/browser/updater/extension_downloader.h" 5 #include "extensions/browser/updater/extension_downloader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 } 246 }
247 247
248 void ExtensionDownloader::DoStartAllPending() { 248 void ExtensionDownloader::DoStartAllPending() {
249 ReportStats(); 249 ReportStats();
250 url_stats_ = URLStats(); 250 url_stats_ = URLStats();
251 251
252 for (FetchMap::iterator it = fetches_preparing_.begin(); 252 for (FetchMap::iterator it = fetches_preparing_.begin();
253 it != fetches_preparing_.end(); 253 it != fetches_preparing_.end();
254 ++it) { 254 ++it) {
255 std::vector<linked_ptr<ManifestFetchData>>& list = it->second; 255 std::vector<std::unique_ptr<ManifestFetchData>>& list = it->second;
256 for (size_t i = 0; i < list.size(); ++i) { 256 for (size_t i = 0; i < list.size(); ++i)
257 StartUpdateCheck(std::unique_ptr<ManifestFetchData>(list[i].release())); 257 StartUpdateCheck(std::move(list[i]));
258 }
259 } 258 }
260 fetches_preparing_.clear(); 259 fetches_preparing_.clear();
261 } 260 }
262 261
263 void ExtensionDownloader::StartBlacklistUpdate( 262 void ExtensionDownloader::StartBlacklistUpdate(
264 const std::string& version, 263 const std::string& version,
265 const ManifestFetchData::PingData& ping_data, 264 const ManifestFetchData::PingData& ping_data,
266 int request_id) { 265 int request_id) {
267 // Note: it is very important that we use the https version of the update 266 // Note: it is very important that we use the https version of the update
268 // url here to avoid DNS hijacking of the blacklist, which is not validated 267 // url here to avoid DNS hijacking of the blacklist, which is not validated
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 ManifestFetchData* existing_fetch = existing_iter->second.back().get(); 363 ManifestFetchData* existing_fetch = existing_iter->second.back().get();
365 if (existing_fetch->AddExtension(id, version.GetString(), 364 if (existing_fetch->AddExtension(id, version.GetString(),
366 optional_ping_data, update_url_data, 365 optional_ping_data, update_url_data,
367 install_source)) { 366 install_source)) {
368 added = true; 367 added = true;
369 } 368 }
370 } 369 }
371 if (!added) { 370 if (!added) {
372 // Otherwise add a new element to the list, if the list doesn't exist or 371 // Otherwise add a new element to the list, if the list doesn't exist or
373 // if its last element is already full. 372 // if its last element is already full.
374 linked_ptr<ManifestFetchData> fetch( 373 std::unique_ptr<ManifestFetchData> fetch(
375 CreateManifestFetchData(update_url, request_id)); 374 CreateManifestFetchData(update_url, request_id));
376 fetches_preparing_[std::make_pair(request_id, update_url)].push_back(fetch); 375 ManifestFetchData* fetch_ptr = fetch.get();
377 added = fetch->AddExtension(id, version.GetString(), optional_ping_data, 376 fetches_preparing_[std::make_pair(request_id, update_url)].push_back(
378 update_url_data, install_source); 377 std::move(fetch));
378 added = fetch_ptr->AddExtension(id, version.GetString(), optional_ping_data,
379 update_url_data, install_source);
379 DCHECK(added); 380 DCHECK(added);
380 } 381 }
381 382
382 return true; 383 return true;
383 } 384 }
384 385
385 void ExtensionDownloader::ReportStats() const { 386 void ExtensionDownloader::ReportStats() const {
386 UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckExtension", 387 UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckExtension",
387 url_stats_.extension_count); 388 url_stats_.extension_count);
388 UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckTheme", 389 UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckTheme",
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 const GURL& update_url, 941 const GURL& update_url,
941 int request_id) { 942 int request_id) {
942 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING; 943 ManifestFetchData::PingMode ping_mode = ManifestFetchData::NO_PING;
943 if (update_url.DomainIs(ping_enabled_domain_.c_str())) 944 if (update_url.DomainIs(ping_enabled_domain_.c_str()))
944 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE; 945 ping_mode = ManifestFetchData::PING_WITH_ENABLED_STATE;
945 return new ManifestFetchData( 946 return new ManifestFetchData(
946 update_url, request_id, brand_code_, manifest_query_params_, ping_mode); 947 update_url, request_id, brand_code_, manifest_query_params_, ping_mode);
947 } 948 }
948 949
949 } // namespace extensions 950 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/updater/extension_downloader.h ('k') | extensions/browser/updater/request_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698