Chromium Code Reviews| Index: content/common/gpu/gpu_memory_manager.h |
| diff --git a/content/common/gpu/gpu_memory_manager.h b/content/common/gpu/gpu_memory_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7cb2aaad5d1c0c05e3793a28b90b4407a5294d3c |
| --- /dev/null |
| +++ b/content/common/gpu/gpu_memory_manager.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
| +#define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
| +#pragma once |
| + |
| +#if defined(ENABLE_GPU) |
| + |
| +#include <vector> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "content/common/content_export.h" |
| + |
| +class GpuCommandBufferStubBase; |
| + |
| +class CONTENT_EXPORT GpuMemoryManagerClient { |
| +public: |
| + virtual ~GpuMemoryManagerClient() {} |
| + |
| + virtual void AppendAllCommandBufferStubs( |
| + std::vector<GpuCommandBufferStubBase*>& stubs) = 0; |
| +}; |
| + |
| +class CONTENT_EXPORT GpuMemoryManager { |
| + public: |
| + static const size_t kDefaultMaxSurfacesWithFrontbufferSoftLimit = 8; |
|
jonathan.backer
2012/02/01 19:43:17
Defined in the .cc? That is was we do for Chrome s
mmocny
2012/02/01 20:44:19
Done.
|
| + |
| + class StubWithSurfaceComparator { |
| + public: |
| + bool operator()(GpuCommandBufferStubBase* lhs, |
| + GpuCommandBufferStubBase* rhs); |
| + }; |
|
jonathan.backer
2012/02/01 19:43:17
Why define this here? Could it be in an anon namsp
mmocny
2012/02/01 20:44:19
For testability. I'll move this down to the priva
|
| + |
| + public: |
| + GpuMemoryManager(GpuMemoryManagerClient* client, |
| + size_t max_surfaces_with_frontbuffer_soft_limit); |
| + ~GpuMemoryManager(); |
| + |
| + void ScheduleManage(); |
| + |
| + private: |
| + friend class GpuMemoryManagerTest; |
| + void Manage(); |
| + void SetMaxSurfacesWithFrontbufferSoftLimit(size_t limit); |
|
jonathan.backer
2012/02/01 19:43:17
Used anywhere?
mmocny
2012/02/01 20:44:19
Not any more, since we now have a constructor argu
|
| + |
| + GpuMemoryManagerClient* client_; |
| + bool manage_scheduled_; |
| + size_t max_surfaces_with_frontbuffer_soft_limit_; |
| + base::WeakPtrFactory<GpuMemoryManager> weak_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); |
| +}; |
| + |
| +#endif |
| + |
| +#endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |