Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | |
| 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #if defined(ENABLE_GPU) | |
| 10 | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/basictypes.h" | |
| 14 #include "base/memory/weak_ptr.h" | |
| 15 #include "content/common/content_export.h" | |
| 16 | |
| 17 class GpuCommandBufferStubBase; | |
| 18 | |
| 19 class CONTENT_EXPORT GpuMemoryManagerClient { | |
| 20 public: | |
| 21 virtual ~GpuMemoryManagerClient() {} | |
| 22 | |
| 23 virtual void AppendAllCommandBufferStubs( | |
| 24 std::vector<GpuCommandBufferStubBase*>& stubs) = 0; | |
| 25 }; | |
| 26 | |
| 27 class CONTENT_EXPORT GpuMemoryManager { | |
| 28 public: | |
| 29 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.
| |
| 30 | |
| 31 class StubWithSurfaceComparator { | |
| 32 public: | |
| 33 bool operator()(GpuCommandBufferStubBase* lhs, | |
| 34 GpuCommandBufferStubBase* rhs); | |
| 35 }; | |
|
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
| |
| 36 | |
| 37 public: | |
| 38 GpuMemoryManager(GpuMemoryManagerClient* client, | |
| 39 size_t max_surfaces_with_frontbuffer_soft_limit); | |
| 40 ~GpuMemoryManager(); | |
| 41 | |
| 42 void ScheduleManage(); | |
| 43 | |
| 44 private: | |
| 45 friend class GpuMemoryManagerTest; | |
| 46 void Manage(); | |
| 47 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
| |
| 48 | |
| 49 GpuMemoryManagerClient* client_; | |
| 50 bool manage_scheduled_; | |
| 51 size_t max_surfaces_with_frontbuffer_soft_limit_; | |
| 52 base::WeakPtrFactory<GpuMemoryManager> weak_factory_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); | |
| 55 }; | |
| 56 | |
| 57 #endif | |
| 58 | |
| 59 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | |
| OLD | NEW |