| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 | 10 |
| 11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "chrome/browser/prerender/prerender_final_status.h" | 13 #include "chrome/browser/prerender/prerender_final_status.h" |
| 14 #include "chrome/browser/prerender/prerender_origin.h" | 14 #include "chrome/browser/prerender/prerender_origin.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 | 16 |
| 17 namespace base { |
| 17 class Value; | 18 class Value; |
| 19 } |
| 18 | 20 |
| 19 namespace prerender { | 21 namespace prerender { |
| 20 | 22 |
| 21 // PrerenderHistory maintains a per-session history of prerendered pages | 23 // PrerenderHistory maintains a per-session history of prerendered pages |
| 22 // and their final dispositions. It has a fixed maximum capacity, and old | 24 // and their final dispositions. It has a fixed maximum capacity, and old |
| 23 // items in history will be removed when the capacity is reached. | 25 // items in history will be removed when the capacity is reached. |
| 24 class PrerenderHistory : public base::NonThreadSafe { | 26 class PrerenderHistory : public base::NonThreadSafe { |
| 25 public: | 27 public: |
| 26 // Entry is an individual entry in the history list. It corresponds to a | 28 // Entry is an individual entry in the history list. It corresponds to a |
| 27 // specific prerendered page. | 29 // specific prerendered page. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 57 explicit PrerenderHistory(size_t max_items); | 59 explicit PrerenderHistory(size_t max_items); |
| 58 ~PrerenderHistory(); | 60 ~PrerenderHistory(); |
| 59 | 61 |
| 60 // Adds |entry| to the history. If at capacity, the oldest entry is dropped. | 62 // Adds |entry| to the history. If at capacity, the oldest entry is dropped. |
| 61 void AddEntry(const Entry& entry); | 63 void AddEntry(const Entry& entry); |
| 62 | 64 |
| 63 // Deletes all history entries. | 65 // Deletes all history entries. |
| 64 void Clear(); | 66 void Clear(); |
| 65 | 67 |
| 66 // Retrieves the entries as a value which can be displayed. | 68 // Retrieves the entries as a value which can be displayed. |
| 67 Value* GetEntriesAsValue() const; | 69 base::Value* GetEntriesAsValue() const; |
| 68 | 70 |
| 69 private: | 71 private: |
| 70 std::list<Entry> entries_; | 72 std::list<Entry> entries_; |
| 71 size_t max_items_; | 73 size_t max_items_; |
| 72 | 74 |
| 73 DISALLOW_COPY_AND_ASSIGN(PrerenderHistory); | 75 DISALLOW_COPY_AND_ASSIGN(PrerenderHistory); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 } | 78 } |
| 77 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTORY_H_ | 79 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTORY_H_ |
| OLD | NEW |