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

Side by Side Diff: components/ntp_snippets/remote/ntp_snippets_service.cc

Issue 2485933003: Fixes an invalidated pointer access in NTPSnipppetsFetcher. (Closed)
Patch Set: adressed other comments from https://codereview.chromium.org/2473483006/ Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/ntp_snippets/remote/ntp_snippets_service.h" 5 #include "components/ntp_snippets/remote/ntp_snippets_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 params.hosts = hosts; 324 params.hosts = hosts;
325 params.interactive_request = interactive_request; 325 params.interactive_request = interactive_request;
326 snippets_fetcher_->FetchSnippets( 326 snippets_fetcher_->FetchSnippets(
327 params, base::BindOnce(&NTPSnippetsService::OnFetchFinished, 327 params, base::BindOnce(&NTPSnippetsService::OnFetchFinished,
328 base::Unretained(this))); 328 base::Unretained(this)));
329 } 329 }
330 330
331 void NTPSnippetsService::Fetch( 331 void NTPSnippetsService::Fetch(
332 const Category& category, 332 const Category& category,
333 const std::set<std::string>& known_suggestion_ids, 333 const std::set<std::string>& known_suggestion_ids,
334 FetchingCallback callback) { 334 const FetchingCallback& callback) {
335 if (!ready()) { 335 if (!ready()) {
336 CallWithEmptyResults(callback); 336 CallWithEmptyResults(callback);
337 return; 337 return;
338 } 338 }
339 NTPSnippetsFetcher::Params params = 339 NTPSnippetsFetcher::Params params =
340 BuildFetchParams(/*exclude_archived_suggestions=*/false); 340 BuildFetchParams(/*exclude_archived_suggestions=*/false);
341 params.excluded_ids.insert(known_suggestion_ids.begin(), 341 params.excluded_ids.insert(known_suggestion_ids.begin(),
342 known_suggestion_ids.end()); 342 known_suggestion_ids.end());
343 params.interactive_request = true; 343 params.interactive_request = true;
344 params.exclusive_category = category; 344 params.exclusive_category = category;
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 } 1237 }
1238 1238
1239 NTPSnippetsService::CategoryContent::CategoryContent() = default; 1239 NTPSnippetsService::CategoryContent::CategoryContent() = default;
1240 NTPSnippetsService::CategoryContent::CategoryContent(CategoryContent&&) = 1240 NTPSnippetsService::CategoryContent::CategoryContent(CategoryContent&&) =
1241 default; 1241 default;
1242 NTPSnippetsService::CategoryContent::~CategoryContent() = default; 1242 NTPSnippetsService::CategoryContent::~CategoryContent() = default;
1243 NTPSnippetsService::CategoryContent& NTPSnippetsService::CategoryContent:: 1243 NTPSnippetsService::CategoryContent& NTPSnippetsService::CategoryContent::
1244 operator=(CategoryContent&&) = default; 1244 operator=(CategoryContent&&) = default;
1245 1245
1246 } // namespace ntp_snippets 1246 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698