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

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

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 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_
7 7
8 #include <cstddef> 8 #include <cstddef>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void RescheduleFetching(bool force); 112 void RescheduleFetching(bool force);
113 113
114 // ContentSuggestionsProvider implementation 114 // ContentSuggestionsProvider implementation
115 CategoryStatus GetCategoryStatus(Category category) override; 115 CategoryStatus GetCategoryStatus(Category category) override;
116 CategoryInfo GetCategoryInfo(Category category) override; 116 CategoryInfo GetCategoryInfo(Category category) override;
117 void DismissSuggestion(const ContentSuggestion::ID& suggestion_id) override; 117 void DismissSuggestion(const ContentSuggestion::ID& suggestion_id) override;
118 void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id, 118 void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id,
119 const ImageFetchedCallback& callback) override; 119 const ImageFetchedCallback& callback) override;
120 void Fetch(const Category& category, 120 void Fetch(const Category& category,
121 const std::set<std::string>& known_suggestion_ids, 121 const std::set<std::string>& known_suggestion_ids,
122 FetchingCallback callback) override; 122 const FetchingCallback& callback) override;
123 void ClearHistory( 123 void ClearHistory(
124 base::Time begin, 124 base::Time begin,
125 base::Time end, 125 base::Time end,
126 const base::Callback<bool(const GURL& url)>& filter) override; 126 const base::Callback<bool(const GURL& url)>& filter) override;
127 void ClearCachedSuggestions(Category category) override; 127 void ClearCachedSuggestions(Category category) override;
128 void GetDismissedSuggestionsForDebugging( 128 void GetDismissedSuggestionsForDebugging(
129 Category category, 129 Category category,
130 const DismissedSuggestionsCallback& callback) override; 130 const DismissedSuggestionsCallback& callback) override;
131 void ClearDismissedSuggestionsForDebugging(Category category) override; 131 void ClearDismissedSuggestionsForDebugging(Category category) override;
132 132
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 343
344 // Returns a non-dismissed snippet with the given |id_within_category|, or 344 // Returns a non-dismissed snippet with the given |id_within_category|, or
345 // null if none exist. 345 // null if none exist.
346 const NTPSnippet* FindSnippet(const std::string& id_within_category) const; 346 const NTPSnippet* FindSnippet(const std::string& id_within_category) const;
347 347
348 CategoryContent(); 348 CategoryContent();
349 CategoryContent(CategoryContent&&); 349 CategoryContent(CategoryContent&&);
350 ~CategoryContent(); 350 ~CategoryContent();
351 CategoryContent& operator=(CategoryContent&&); 351 CategoryContent& operator=(CategoryContent&&);
352 }; 352 };
353 using CategoryContentMap = 353
354 std::map<Category, CategoryContent, Category::CompareByID>; 354 std::map<Category, CategoryContent, Category::CompareByID> categories_;
355 CategoryContentMap categories_;
356 355
357 // The ISO 639-1 code of the language used by the application. 356 // The ISO 639-1 code of the language used by the application.
358 const std::string application_language_code_; 357 const std::string application_language_code_;
359 358
360 // Classifier that tells us how active the user is. Not owned. 359 // Classifier that tells us how active the user is. Not owned.
361 const UserClassifier* user_classifier_; 360 const UserClassifier* user_classifier_;
362 361
363 // Scheduler for fetching snippets. Not owned. 362 // Scheduler for fetching snippets. Not owned.
364 NTPSnippetsScheduler* scheduler_; 363 NTPSnippetsScheduler* scheduler_;
365 364
(...skipping 21 matching lines...) Expand all
387 386
388 // Request throttler for limiting requests to thumbnail images. 387 // Request throttler for limiting requests to thumbnail images.
389 RequestThrottler thumbnail_requests_throttler_; 388 RequestThrottler thumbnail_requests_throttler_;
390 389
391 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsService); 390 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsService);
392 }; 391 };
393 392
394 } // namespace ntp_snippets 393 } // namespace ntp_snippets
395 394
396 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ 395 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698