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

Side by Side Diff: cc/raster/staging_buffer_pool.h

Issue 2286583002: Make cc::SoftwareImageDecodeController, cc::ResourcePool, and cc::StagingBufferPoo… (Closed)
Patch Set: Patch for landing Created 4 years, 3 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
« no previous file with comments | « no previous file | cc/raster/staging_buffer_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/memory_coordinator_client.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "base/trace_event/memory_dump_provider.h" 19 #include "base/trace_event/memory_dump_provider.h"
19 #include "cc/output/context_provider.h" 20 #include "cc/output/context_provider.h"
20 #include "cc/resources/resource_provider.h" 21 #include "cc/resources/resource_provider.h"
21 22
22 namespace gpu { 23 namespace gpu {
23 namespace gles2 { 24 namespace gles2 {
24 class GLES2Interface; 25 class GLES2Interface;
(...skipping 18 matching lines...) Expand all
43 const ResourceFormat format; 44 const ResourceFormat format;
44 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer; 45 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer;
45 base::TimeTicks last_usage; 46 base::TimeTicks last_usage;
46 unsigned texture_id; 47 unsigned texture_id;
47 unsigned image_id; 48 unsigned image_id;
48 unsigned query_id; 49 unsigned query_id;
49 uint64_t content_id; 50 uint64_t content_id;
50 }; 51 };
51 52
52 class CC_EXPORT StagingBufferPool 53 class CC_EXPORT StagingBufferPool
53 : public base::trace_event::MemoryDumpProvider { 54 : public base::trace_event::MemoryDumpProvider,
55 public base::MemoryCoordinatorClient {
54 public: 56 public:
55 ~StagingBufferPool() final; 57 ~StagingBufferPool() final;
56 58
57 StagingBufferPool(base::SequencedTaskRunner* task_runner, 59 StagingBufferPool(base::SequencedTaskRunner* task_runner,
58 ContextProvider* worker_context_provider, 60 ContextProvider* worker_context_provider,
59 ResourceProvider* resource_provider, 61 ResourceProvider* resource_provider,
60 bool use_partial_raster, 62 bool use_partial_raster,
61 int max_staging_buffer_usage_in_bytes); 63 int max_staging_buffer_usage_in_bytes);
62 void Shutdown(); 64 void Shutdown();
63 65
(...skipping 16 matching lines...) Expand all
80 base::TimeTicks GetUsageTimeForLRUBuffer(); 82 base::TimeTicks GetUsageTimeForLRUBuffer();
81 void ScheduleReduceMemoryUsage(); 83 void ScheduleReduceMemoryUsage();
82 void ReduceMemoryUsage(); 84 void ReduceMemoryUsage();
83 void ReleaseBuffersNotUsedSince(base::TimeTicks time); 85 void ReleaseBuffersNotUsedSince(base::TimeTicks time);
84 86
85 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> StateAsValue() 87 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> StateAsValue()
86 const; 88 const;
87 void StagingStateAsValueInto( 89 void StagingStateAsValueInto(
88 base::trace_event::TracedValue* staging_state) const; 90 base::trace_event::TracedValue* staging_state) const;
89 91
92 // Overriden from base::MemoryCoordinatorClient.
93 void OnMemoryStateChange(base::MemoryState state) override;
94
90 scoped_refptr<base::SequencedTaskRunner> task_runner_; 95 scoped_refptr<base::SequencedTaskRunner> task_runner_;
91 ContextProvider* const worker_context_provider_; 96 ContextProvider* const worker_context_provider_;
92 ResourceProvider* const resource_provider_; 97 ResourceProvider* const resource_provider_;
93 const bool use_partial_raster_; 98 const bool use_partial_raster_;
94 99
95 mutable base::Lock lock_; 100 mutable base::Lock lock_;
96 // |lock_| must be acquired when accessing the following members. 101 // |lock_| must be acquired when accessing the following members.
97 using StagingBufferSet = std::set<const StagingBuffer*>; 102 using StagingBufferSet = std::set<const StagingBuffer*>;
98 StagingBufferSet buffers_; 103 StagingBufferSet buffers_;
99 using StagingBufferDeque = std::deque<std::unique_ptr<StagingBuffer>>; 104 using StagingBufferDeque = std::deque<std::unique_ptr<StagingBuffer>>;
100 StagingBufferDeque free_buffers_; 105 StagingBufferDeque free_buffers_;
101 StagingBufferDeque busy_buffers_; 106 StagingBufferDeque busy_buffers_;
102 const int max_staging_buffer_usage_in_bytes_; 107 const int max_staging_buffer_usage_in_bytes_;
103 int staging_buffer_usage_in_bytes_; 108 int staging_buffer_usage_in_bytes_;
104 int free_staging_buffer_usage_in_bytes_; 109 int free_staging_buffer_usage_in_bytes_;
105 const base::TimeDelta staging_buffer_expiration_delay_; 110 const base::TimeDelta staging_buffer_expiration_delay_;
106 bool reduce_memory_usage_pending_; 111 bool reduce_memory_usage_pending_;
107 base::Closure reduce_memory_usage_callback_; 112 base::Closure reduce_memory_usage_callback_;
108 113
109 base::WeakPtrFactory<StagingBufferPool> weak_ptr_factory_; 114 base::WeakPtrFactory<StagingBufferPool> weak_ptr_factory_;
110 115
111 DISALLOW_COPY_AND_ASSIGN(StagingBufferPool); 116 DISALLOW_COPY_AND_ASSIGN(StagingBufferPool);
112 }; 117 };
113 118
114 } // namespace cc 119 } // namespace cc
115 120
116 #endif // CC_RASTER_STAGING_BUFFER_POOL_H_ 121 #endif // CC_RASTER_STAGING_BUFFER_POOL_H_
OLDNEW
« no previous file with comments | « no previous file | cc/raster/staging_buffer_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698