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

Side by Side Diff: content/common/gpu/gpu_memory_manager.h

Issue 10083056: GpuMemoryManager suggests values for renderer Contents Texture Managers' preferred memory limit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: On max 10.5, it fails to init command buffer, and my callback code didn't guard against that. Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_memory_allocation.h ('k') | content/common/gpu/gpu_memory_manager.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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #if defined(ENABLE_GPU) 9 #if defined(ENABLE_GPU)
10 10
(...skipping 10 matching lines...) Expand all
21 virtual ~GpuMemoryManagerClient() {} 21 virtual ~GpuMemoryManagerClient() {}
22 22
23 virtual void AppendAllCommandBufferStubs( 23 virtual void AppendAllCommandBufferStubs(
24 std::vector<GpuCommandBufferStubBase*>& stubs) = 0; 24 std::vector<GpuCommandBufferStubBase*>& stubs) = 0;
25 }; 25 };
26 26
27 class CONTENT_EXPORT GpuMemoryManager { 27 class CONTENT_EXPORT GpuMemoryManager {
28 public: 28 public:
29 enum { kDefaultMaxSurfacesWithFrontbufferSoftLimit = 8 }; 29 enum { kDefaultMaxSurfacesWithFrontbufferSoftLimit = 8 };
30 30
31 // These are predefined values (in bytes) for
32 // GpuMemoryAllocation::gpuResourceSizeInBytes.
33 // Maximum Allocation for all tabs is a soft limit that can be exceeded
34 // during the time it takes for renderers to respect new allocations,
35 // including when switching tabs or opening a new window.
36 // To alleviate some pressure, we decrease our desired limit by "one tabs'
37 // worth" of memory.
38 enum {
39 #if defined(OS_ANDROID)
40 kMinimumAllocationForTab = 32 * 1024 * 1024,
41 kMaximumAllocationForTabs = 64 * 1024 * 1024,
42 #else
43 kMinimumAllocationForTab = 64 * 1024 * 1024,
44 kMaximumAllocationForTabs = 512 * 1024 * 1024 - kMinimumAllocationForTab,
45 #endif
46 };
47
31 GpuMemoryManager(GpuMemoryManagerClient* client, 48 GpuMemoryManager(GpuMemoryManagerClient* client,
32 size_t max_surfaces_with_frontbuffer_soft_limit); 49 size_t max_surfaces_with_frontbuffer_soft_limit);
33 ~GpuMemoryManager(); 50 ~GpuMemoryManager();
34 51
35 void ScheduleManage(); 52 void ScheduleManage();
36 53
37 private: 54 private:
38 friend class GpuMemoryManagerTest; 55 friend class GpuMemoryManagerTest;
39 void Manage(); 56 void Manage();
40 57
41 class CONTENT_EXPORT StubWithSurfaceComparator { 58 class CONTENT_EXPORT StubWithSurfaceComparator {
42 public: 59 public:
43 bool operator()(GpuCommandBufferStubBase* lhs, 60 bool operator()(GpuCommandBufferStubBase* lhs,
44 GpuCommandBufferStubBase* rhs); 61 GpuCommandBufferStubBase* rhs);
45 }; 62 };
46 63
47 GpuMemoryManagerClient* client_; 64 GpuMemoryManagerClient* client_;
48 bool manage_scheduled_; 65 bool manage_scheduled_;
49 size_t max_surfaces_with_frontbuffer_soft_limit_; 66 size_t max_surfaces_with_frontbuffer_soft_limit_;
50 base::WeakPtrFactory<GpuMemoryManager> weak_factory_; 67 base::WeakPtrFactory<GpuMemoryManager> weak_factory_;
51 68
52 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); 69 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager);
53 }; 70 };
54 71
55 #endif 72 #endif
56 73
57 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ 74 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_memory_allocation.h ('k') | content/common/gpu/gpu_memory_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698