Chromium Code Reviews| Index: components/previews/core/previews_black_list_item.h |
| diff --git a/components/previews/core/previews_black_list_item.h b/components/previews/core/previews_black_list_item.h |
| index 462e61d1c4ade6782ada52f7035baef9dd35d5b2..ee82aae22e9485e89d40c66c4b75710f6ebe4f02 100644 |
| --- a/components/previews/core/previews_black_list_item.h |
| +++ b/components/previews/core/previews_black_list_item.h |
| @@ -1,20 +1,20 @@ |
| // Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #ifndef COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_ITEM_H_ |
| #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_BLACK_LIST_ITEM_H_ |
| #include <stdint.h> |
| -#include <list> |
| +#include <deque> |
| #include <map> |
| #include <memory> |
| #include <string> |
| #include "base/callback.h" |
| #include "base/macros.h" |
| #include "base/optional.h" |
| #include "base/time/time.h" |
| namespace previews { |
| @@ -42,36 +42,37 @@ class PreviewsBlackListItem { |
| base::Optional<base::Time> most_recent_opt_out_time() const { |
| return most_recent_opt_out_time_; |
| } |
| private: |
| // A previews navigation to this host is represented by time and whether the |
| // navigation was an opt out. |
| struct OptOutRecord { |
| OptOutRecord(base::Time entry_time, bool opt_out); |
| - ~OptOutRecord() {} |
| - const base::Time |
| - entry_time; // The time that the opt out state was determined. |
| - const bool opt_out; // Whether the user opt out of the preview. |
| + OptOutRecord& operator=(const OptOutRecord&); |
| + ~OptOutRecord(); |
| + |
| + base::Time entry_time; // The time that the opt out state was determined. |
|
tbansal1
2016/10/21 22:56:26
What happens if you keep them as const?
I am a bit
RyanSturm
2016/10/24 22:24:40
Since priority_queue is basically a vector of thes
|
| + bool opt_out; // Whether the user opt out of the preview. |
| }; |
| // The number of entries to store to determine preview eligibility. |
| const size_t max_stored_history_length_; |
| // The number opt outs in recent history that will trigger blacklisting. |
| const int opt_out_black_list_threshold_; |
| // The amount of time to black list a domain after the most recent opt out. |
| const base::TimeDelta max_black_list_duration_; |
| // The |max_stored_history_length_| most recent previews navigation. Is |
| // maintained as a list sorted by entry_time (earliest to latest). |
| - std::list<OptOutRecord> opt_out_records_; |
| + std::deque<OptOutRecord> opt_out_records_; |
|
tbansal1
2016/10/21 22:56:26
Since the list needs to be sorted, why not just us
RyanSturm
2016/10/24 22:24:40
Done.
|
| // Time of the most recent opt out. |
| base::Optional<base::Time> most_recent_opt_out_time_; |
| // The total number of opt outs currently in |opt_out_records_|. |
| int total_opt_out_; |
| DISALLOW_COPY_AND_ASSIGN(PreviewsBlackListItem); |
| }; |