| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_PRERENDER_PRERENDER_HISTORY_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_HISTORY_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HISTORY_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HISTORY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/threading/non_thread_safe.h" | 13 #include "base/sequence_checker.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "chrome/browser/prerender/prerender_final_status.h" | 15 #include "chrome/browser/prerender/prerender_final_status.h" |
| 16 #include "chrome/browser/prerender/prerender_origin.h" | 16 #include "chrome/browser/prerender/prerender_origin.h" |
| 17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class Value; | 20 class Value; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace prerender { | 23 namespace prerender { |
| 24 | 24 |
| 25 // PrerenderHistory maintains a per-session history of prerendered pages | 25 // PrerenderHistory maintains a per-session history of prerendered pages |
| 26 // and their final dispositions. It has a fixed maximum capacity, and old | 26 // and their final dispositions. It has a fixed maximum capacity, and old |
| 27 // items in history will be removed when the capacity is reached. | 27 // items in history will be removed when the capacity is reached. |
| 28 class PrerenderHistory : public base::NonThreadSafe { | 28 class PrerenderHistory { |
| 29 public: | 29 public: |
| 30 // Entry is an individual entry in the history list. It corresponds to a | 30 // Entry is an individual entry in the history list. It corresponds to a |
| 31 // specific prerendered page. | 31 // specific prerendered page. |
| 32 struct Entry { | 32 struct Entry { |
| 33 Entry() : final_status(FINAL_STATUS_MAX), origin(ORIGIN_MAX) {} | 33 Entry() : final_status(FINAL_STATUS_MAX), origin(ORIGIN_MAX) {} |
| 34 | 34 |
| 35 Entry(const GURL& url_arg, | 35 Entry(const GURL& url_arg, |
| 36 FinalStatus final_status_arg, | 36 FinalStatus final_status_arg, |
| 37 Origin origin_arg, | 37 Origin origin_arg, |
| 38 base::Time end_time_arg) | 38 base::Time end_time_arg) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 // Deletes all history entries. | 67 // Deletes all history entries. |
| 68 void Clear(); | 68 void Clear(); |
| 69 | 69 |
| 70 // Retrieves the entries as a value which can be displayed. | 70 // Retrieves the entries as a value which can be displayed. |
| 71 std::unique_ptr<base::Value> CopyEntriesAsValue() const; | 71 std::unique_ptr<base::Value> CopyEntriesAsValue() const; |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 std::list<Entry> entries_; | 74 std::list<Entry> entries_; |
| 75 size_t max_items_; | 75 size_t max_items_; |
| 76 | 76 |
| 77 SEQUENCE_CHECKER(sequence_checker_); |
| 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(PrerenderHistory); | 79 DISALLOW_COPY_AND_ASSIGN(PrerenderHistory); |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 } // namespace prerender | 82 } // namespace prerender |
| 81 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTORY_H_ | 83 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTORY_H_ |
| OLD | NEW |