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

Side by Side Diff: content/browser/renderer_host/renderer_frame_manager.h

Issue 2648323005: memory coordinator: Add MemoryCoordinatorClient::OnPurgeMemory() (Closed)
Patch Set: Created 3 years, 11 months 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 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_RENDERER_HOST_RENDERER_FRAME_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDERER_FRAME_MANAGER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDERER_FRAME_MANAGER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDERER_FRAME_MANAGER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 void set_max_handles(float max_handles) { max_handles_ = max_handles; } 51 void set_max_handles(float max_handles) { max_handles_ = max_handles; }
52 52
53 private: 53 private:
54 // Please remove when crbug.com/443824 has been fixed. 54 // Please remove when crbug.com/443824 has been fixed.
55 friend class RenderWidgetHostViewAuraTest; 55 friend class RenderWidgetHostViewAuraTest;
56 56
57 RendererFrameManager(); 57 RendererFrameManager();
58 ~RendererFrameManager() override; 58 ~RendererFrameManager() override;
59 59
60 // base::MemoryCoordinatorClient implementation: 60 // base::MemoryCoordinatorClient implementation:
61 void OnMemoryStateChange(base::MemoryState state) override; 61 void OnPurgeMemory() override;
62 62
63 void CullUnlockedFrames(size_t saved_frame_limit); 63 void CullUnlockedFrames(size_t saved_frame_limit);
64 64
65 // React on memory pressure events to adjust the number of cached frames. 65 // React on memory pressure events to adjust the number of cached frames.
66 void OnMemoryPressure( 66 void OnMemoryPressure(
67 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); 67 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
68 68
69 void PurgeMemory(int percentage); 69 void PurgeMemory(int percentage);
70 70
71 friend struct base::DefaultSingletonTraits<RendererFrameManager>; 71 friend struct base::DefaultSingletonTraits<RendererFrameManager>;
72 72
73 // Listens for system under pressure notifications and adjusts number of 73 // Listens for system under pressure notifications and adjusts number of
74 // cached frames accordingly. 74 // cached frames accordingly.
75 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; 75 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
76 76
77 std::map<RendererFrameManagerClient*, size_t> locked_frames_; 77 std::map<RendererFrameManagerClient*, size_t> locked_frames_;
78 std::list<RendererFrameManagerClient*> unlocked_frames_; 78 std::list<RendererFrameManagerClient*> unlocked_frames_;
79 size_t max_number_of_saved_frames_; 79 size_t max_number_of_saved_frames_;
80 float max_handles_; 80 float max_handles_;
81 81
82 DISALLOW_COPY_AND_ASSIGN(RendererFrameManager); 82 DISALLOW_COPY_AND_ASSIGN(RendererFrameManager);
83 }; 83 };
84 84
85 } // namespace content 85 } // namespace content
86 86
87 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDERER_FRAME_MANAGER_H_ 87 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDERER_FRAME_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698