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

Side by Side Diff: cc/raster/staging_buffer_pool.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CC_RASTER_STAGING_BUFFER_POOL_H_ 5 #ifndef CC_RASTER_STAGING_BUFFER_POOL_H_
6 #define CC_RASTER_STAGING_BUFFER_POOL_H_ 6 #define CC_RASTER_STAGING_BUFFER_POOL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <deque> 10 #include <deque>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void ScheduleReduceMemoryUsage(); 83 void ScheduleReduceMemoryUsage();
84 void ReduceMemoryUsage(); 84 void ReduceMemoryUsage();
85 void ReleaseBuffersNotUsedSince(base::TimeTicks time); 85 void ReleaseBuffersNotUsedSince(base::TimeTicks time);
86 86
87 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> StateAsValue() 87 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> StateAsValue()
88 const; 88 const;
89 void StagingStateAsValueInto( 89 void StagingStateAsValueInto(
90 base::trace_event::TracedValue* staging_state) const; 90 base::trace_event::TracedValue* staging_state) const;
91 91
92 // Overriden from base::MemoryCoordinatorClient. 92 // Overriden from base::MemoryCoordinatorClient.
93 void OnMemoryStateChange(base::MemoryState state) override; 93 void OnPurgeMemory() override;
94 94
95 scoped_refptr<base::SequencedTaskRunner> task_runner_; 95 scoped_refptr<base::SequencedTaskRunner> task_runner_;
96 ContextProvider* const worker_context_provider_; 96 ContextProvider* const worker_context_provider_;
97 ResourceProvider* const resource_provider_; 97 ResourceProvider* const resource_provider_;
98 const bool use_partial_raster_; 98 const bool use_partial_raster_;
99 99
100 mutable base::Lock lock_; 100 mutable base::Lock lock_;
101 // |lock_| must be acquired when accessing the following members. 101 // |lock_| must be acquired when accessing the following members.
102 using StagingBufferSet = std::set<const StagingBuffer*>; 102 using StagingBufferSet = std::set<const StagingBuffer*>;
103 StagingBufferSet buffers_; 103 StagingBufferSet buffers_;
104 using StagingBufferDeque = std::deque<std::unique_ptr<StagingBuffer>>; 104 using StagingBufferDeque = std::deque<std::unique_ptr<StagingBuffer>>;
105 StagingBufferDeque free_buffers_; 105 StagingBufferDeque free_buffers_;
106 StagingBufferDeque busy_buffers_; 106 StagingBufferDeque busy_buffers_;
107 const int max_staging_buffer_usage_in_bytes_; 107 const int max_staging_buffer_usage_in_bytes_;
108 int staging_buffer_usage_in_bytes_; 108 int staging_buffer_usage_in_bytes_;
109 int free_staging_buffer_usage_in_bytes_; 109 int free_staging_buffer_usage_in_bytes_;
110 const base::TimeDelta staging_buffer_expiration_delay_; 110 const base::TimeDelta staging_buffer_expiration_delay_;
111 bool reduce_memory_usage_pending_; 111 bool reduce_memory_usage_pending_;
112 base::Closure reduce_memory_usage_callback_; 112 base::Closure reduce_memory_usage_callback_;
113 113
114 base::WeakPtrFactory<StagingBufferPool> weak_ptr_factory_; 114 base::WeakPtrFactory<StagingBufferPool> weak_ptr_factory_;
115 115
116 DISALLOW_COPY_AND_ASSIGN(StagingBufferPool); 116 DISALLOW_COPY_AND_ASSIGN(StagingBufferPool);
117 }; 117 };
118 118
119 } // namespace cc 119 } // namespace cc
120 120
121 #endif // CC_RASTER_STAGING_BUFFER_POOL_H_ 121 #endif // CC_RASTER_STAGING_BUFFER_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698