| 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_CLIENT_H_ | |
| 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_CLIENT_H_ | |
| 7 | |
| 8 #include <list> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "content/common/content_export.h" | |
| 12 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | |
| 13 #include "gpu/command_buffer/service/memory_tracking.h" | |
| 14 #include "ui/gfx/geometry/size.h" | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 class GpuMemoryManager; | |
| 19 class GpuMemoryTrackingGroup; | |
| 20 | |
| 21 // The interface that the GPU memory manager uses to manipulate a client (to | |
| 22 // send it allocation information and query its properties). | |
| 23 class CONTENT_EXPORT GpuMemoryManagerClient { | |
| 24 public: | |
| 25 virtual ~GpuMemoryManagerClient() {} | |
| 26 | |
| 27 // Returns surface size. | |
| 28 virtual gfx::Size GetSurfaceSize() const = 0; | |
| 29 | |
| 30 // Returns the memory tracker for this stub. | |
| 31 virtual gpu::gles2::MemoryTracker* GetMemoryTracker() const = 0; | |
| 32 | |
| 33 virtual void SuggestHaveFrontBuffer(bool suggest_have_frontbuffer) = 0; | |
| 34 | |
| 35 // Returns in bytes the total amount of GPU memory for the GPU which this | |
| 36 // context is currently rendering on. Returns false if no extension exists | |
| 37 // to get the exact amount of GPU memory. | |
| 38 virtual bool GetTotalGpuMemory(uint64* bytes) = 0; | |
| 39 }; | |
| 40 | |
| 41 // The state associated with a GPU memory manager client. This acts as the | |
| 42 // handle through which the client interacts with the GPU memory manager. | |
| 43 class CONTENT_EXPORT GpuMemoryManagerClientState { | |
| 44 public: | |
| 45 ~GpuMemoryManagerClientState(); | |
| 46 void SetVisible(bool visible); | |
| 47 | |
| 48 private: | |
| 49 friend class GpuMemoryManager; | |
| 50 | |
| 51 GpuMemoryManagerClientState(GpuMemoryManager* memory_manager, | |
| 52 GpuMemoryManagerClient* client, | |
| 53 GpuMemoryTrackingGroup* tracking_group, | |
| 54 bool has_surface, | |
| 55 bool visible); | |
| 56 | |
| 57 // The memory manager this client is hanging off of. | |
| 58 GpuMemoryManager* memory_manager_; | |
| 59 | |
| 60 // The client to send allocations to. | |
| 61 GpuMemoryManagerClient* client_; | |
| 62 | |
| 63 // The tracking group for this client. | |
| 64 GpuMemoryTrackingGroup* tracking_group_; | |
| 65 | |
| 66 // Offscreen commandbuffers will not have a surface. | |
| 67 const bool has_surface_; | |
| 68 | |
| 69 // Whether or not this client is visible. | |
| 70 bool visible_; | |
| 71 | |
| 72 // If the client has a surface, then this is an iterator in the | |
| 73 // clients_visible_mru_ if this client is visible and | |
| 74 // clients_nonvisible_mru_ if this is non-visible. Otherwise this is an | |
| 75 // iterator in clients_nonsurface_. | |
| 76 std::list<GpuMemoryManagerClientState*>::iterator list_iterator_; | |
| 77 bool list_iterator_valid_; | |
| 78 | |
| 79 // Set to disable allocating a frontbuffer or to disable allocations | |
| 80 // for clients that don't have surfaces. | |
| 81 bool hibernated_; | |
| 82 }; | |
| 83 | |
| 84 } // namespace content | |
| 85 | |
| 86 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_CLIENT_H_ | |
| OLD | NEW |