OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 bool ClearScreenshot(NavigationEntryImpl* entry); | 67 bool ClearScreenshot(NavigationEntryImpl* entry); |
68 | 68 |
69 // The screenshots in the NavigationEntryImpls can accumulate and consume a | 69 // The screenshots in the NavigationEntryImpls can accumulate and consume a |
70 // large amount of memory. This function makes sure that the memory | 70 // large amount of memory. This function makes sure that the memory |
71 // consumption is within a certain limit. | 71 // consumption is within a certain limit. |
72 void PurgeScreenshotsIfNecessary(); | 72 void PurgeScreenshotsIfNecessary(); |
73 | 73 |
74 // The navigation controller that owns this screenshot-manager. | 74 // The navigation controller that owns this screenshot-manager. |
75 NavigationControllerImpl* owner_; | 75 NavigationControllerImpl* owner_; |
76 | 76 |
| 77 base::Time last_screenshot_time_; |
| 78 int min_screenshot_interval_ms_; |
| 79 |
77 // Taking a screenshot and encoding them can be async. So use a weakptr for | 80 // Taking a screenshot and encoding them can be async. So use a weakptr for |
78 // the callback to make sure that the screenshot/encoding completion callback | 81 // the callback to make sure that the screenshot/encoding completion callback |
79 // does not trigger on a destroyed NavigationEntryScreenshotManager. | 82 // does not trigger on a destroyed NavigationEntryScreenshotManager. |
80 base::WeakPtrFactory<NavigationEntryScreenshotManager> screenshot_factory_; | 83 base::WeakPtrFactory<NavigationEntryScreenshotManager> screenshot_factory_; |
81 | 84 |
82 base::Time last_screenshot_time_; | |
83 int min_screenshot_interval_ms_; | |
84 | |
85 DISALLOW_COPY_AND_ASSIGN(NavigationEntryScreenshotManager); | 85 DISALLOW_COPY_AND_ASSIGN(NavigationEntryScreenshotManager); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace content | 88 } // namespace content |
89 | 89 |
90 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ | 90 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_SCREENSHOT_MANAGER_H_ |
OLD | NEW |