| OLD | NEW |
| 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/memory_coordinator_client.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "base/trace_event/memory_dump_provider.h" | 19 #include "base/trace_event/memory_dump_provider.h" |
| 20 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
| 21 #include "cc/output/context_provider.h" | 21 #include "cc/output/context_provider.h" |
| 22 #include "cc/resources/resource_provider.h" | 22 #include "cc/resources/resource_provider.h" |
| 23 | 23 |
| 24 namespace gfx { |
| 25 class GpuFence; |
| 26 } |
| 27 |
| 24 namespace gpu { | 28 namespace gpu { |
| 25 namespace gles2 { | 29 namespace gles2 { |
| 26 class GLES2Interface; | 30 class GLES2Interface; |
| 27 } | 31 } |
| 28 } | 32 } |
| 29 | 33 |
| 30 namespace cc { | 34 namespace cc { |
| 31 class Resource; | 35 class Resource; |
| 32 class RasterSource; | 36 class RasterSource; |
| 33 class ResourcePool; | 37 class ResourcePool; |
| 34 | 38 |
| 35 struct StagingBuffer { | 39 struct StagingBuffer { |
| 36 StagingBuffer(const gfx::Size& size, ResourceFormat format); | 40 StagingBuffer(const gfx::Size& size, ResourceFormat format); |
| 37 ~StagingBuffer(); | 41 ~StagingBuffer(); |
| 38 | 42 |
| 39 void DestroyGLResources(gpu::gles2::GLES2Interface* gl); | 43 void DestroyGLResources(gpu::gles2::GLES2Interface* gl); |
| 40 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, | 44 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
| 41 ResourceFormat format, | 45 ResourceFormat format, |
| 42 bool is_free) const; | 46 bool is_free) const; |
| 43 | 47 |
| 44 const gfx::Size size; | 48 const gfx::Size size; |
| 45 const ResourceFormat format; | 49 const ResourceFormat format; |
| 46 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer; | 50 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer; |
| 51 std::unique_ptr<gfx::GpuFence> gpu_fence; |
| 47 base::TimeTicks last_usage; | 52 base::TimeTicks last_usage; |
| 48 unsigned texture_id; | |
| 49 unsigned image_id; | 53 unsigned image_id; |
| 50 unsigned query_id; | 54 unsigned fence_id; |
| 51 uint64_t content_id; | 55 uint64_t content_id; |
| 52 }; | 56 }; |
| 53 | 57 |
| 54 class CC_EXPORT StagingBufferPool | 58 class CC_EXPORT StagingBufferPool |
| 55 : public base::trace_event::MemoryDumpProvider, | 59 : public base::trace_event::MemoryDumpProvider, |
| 56 public base::MemoryCoordinatorClient { | 60 public base::MemoryCoordinatorClient { |
| 57 public: | 61 public: |
| 58 ~StagingBufferPool() final; | 62 ~StagingBufferPool() final; |
| 59 | 63 |
| 60 StagingBufferPool(base::SequencedTaskRunner* task_runner, | 64 StagingBufferPool(base::SequencedTaskRunner* task_runner, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 base::Closure reduce_memory_usage_callback_; | 118 base::Closure reduce_memory_usage_callback_; |
| 115 | 119 |
| 116 base::WeakPtrFactory<StagingBufferPool> weak_ptr_factory_; | 120 base::WeakPtrFactory<StagingBufferPool> weak_ptr_factory_; |
| 117 | 121 |
| 118 DISALLOW_COPY_AND_ASSIGN(StagingBufferPool); | 122 DISALLOW_COPY_AND_ASSIGN(StagingBufferPool); |
| 119 }; | 123 }; |
| 120 | 124 |
| 121 } // namespace cc | 125 } // namespace cc |
| 122 | 126 |
| 123 #endif // CC_RASTER_STAGING_BUFFER_POOL_H_ | 127 #endif // CC_RASTER_STAGING_BUFFER_POOL_H_ |
| OLD | NEW |