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

Side by Side Diff: content/common/gpu/gpu_memory_allocation.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: Fixing issue with every proxy registering a callback, even when it is null. Created 8 years, 8 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
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_ALLOCATION_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_ 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 10
11 // These are per context memory allocation limits set by the GpuMemoryManager 11 // These are per context memory allocation limits set by the GpuMemoryManager
12 // and assigned to the browser and renderer context. 12 // and assigned to the browser and renderer context.
13 // They will change over time, given memory availability, and browser state. 13 // They will change over time, given memory availability, and browser state.
14 14
15
16 // Memory Allocation which will be assigned to the renderer context. 15 // Memory Allocation which will be assigned to the renderer context.
17 struct GpuMemoryAllocationForRenderer { 16 struct GpuMemoryAllocationForRenderer {
18 enum { 17 enum {
19 INVALID_RESOURCE_SIZE = -1 18 INVALID_RESOURCE_SIZE = -1
20 }; 19 };
21 20
22 // Exceeding this limit for an unreasonable amount of time may cause context 21 // Exceeding this limit for an unreasonable amount of time may cause context
23 // to be lost. 22 // to be lost.
24 size_t gpu_resource_size_in_bytes; 23 size_t gpu_resource_size_in_bytes;
25 bool suggest_have_backbuffer; 24 bool suggest_have_backbuffer;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 60 }
62 bool operator!=(const GpuMemoryAllocationForBrowser& other) const { 61 bool operator!=(const GpuMemoryAllocationForBrowser& other) const {
63 return !(*this == other); 62 return !(*this == other);
64 } 63 }
65 }; 64 };
66 65
67 // Combination of the above two Memory Allocations which will be created by the 66 // Combination of the above two Memory Allocations which will be created by the
68 // GpuMemoryManager. 67 // GpuMemoryManager.
69 struct GpuMemoryAllocation : public GpuMemoryAllocationForRenderer, 68 struct GpuMemoryAllocation : public GpuMemoryAllocationForRenderer,
70 public GpuMemoryAllocationForBrowser { 69 public GpuMemoryAllocationForBrowser {
70 // Bitmap
71 enum BufferAllocation {
72 kHasNoBuffers = 0,
73 kHasFrontbuffer = 1,
74 kHasBackbuffer = 2
75 };
76
71 GpuMemoryAllocation() 77 GpuMemoryAllocation()
72 : GpuMemoryAllocationForRenderer(), 78 : GpuMemoryAllocationForRenderer(),
73 GpuMemoryAllocationForBrowser() { 79 GpuMemoryAllocationForBrowser() {
74 } 80 }
75 81
76 GpuMemoryAllocation(size_t gpu_resource_size_in_bytes, 82 GpuMemoryAllocation(size_t gpu_resource_size_in_bytes,
77 bool suggest_have_backbuffer, 83 bool suggest_have_backbuffer,
78 bool suggest_have_frontbuffer) 84 bool suggest_have_frontbuffer)
79 : GpuMemoryAllocationForRenderer(gpu_resource_size_in_bytes, 85 : GpuMemoryAllocationForRenderer(gpu_resource_size_in_bytes,
80 suggest_have_backbuffer), 86 suggest_have_backbuffer),
81 GpuMemoryAllocationForBrowser(suggest_have_frontbuffer) { 87 GpuMemoryAllocationForBrowser(suggest_have_frontbuffer) {
82 } 88 }
83 89
90 GpuMemoryAllocation(size_t gpu_resource_size_in_bytes,
91 int allocationBitmap)
92 : GpuMemoryAllocationForRenderer(gpu_resource_size_in_bytes,
93 allocationBitmap & kHasBackbuffer),
94 GpuMemoryAllocationForBrowser(allocationBitmap & kHasFrontbuffer) {
95 }
96
84 bool operator==(const GpuMemoryAllocation& other) const { 97 bool operator==(const GpuMemoryAllocation& other) const {
85 return static_cast<const GpuMemoryAllocationForRenderer&>(*this) == 98 return static_cast<const GpuMemoryAllocationForRenderer&>(*this) ==
86 static_cast<const GpuMemoryAllocationForRenderer&>(other) && 99 static_cast<const GpuMemoryAllocationForRenderer&>(other) &&
87 static_cast<const GpuMemoryAllocationForBrowser&>(*this) == 100 static_cast<const GpuMemoryAllocationForBrowser&>(*this) ==
88 static_cast<const GpuMemoryAllocationForBrowser&>(other); 101 static_cast<const GpuMemoryAllocationForBrowser&>(other);
89 } 102 }
90 bool operator!=(const GpuMemoryAllocation& other) const { 103 bool operator!=(const GpuMemoryAllocation& other) const {
91 return !(*this == other); 104 return !(*this == other);
92 } 105 }
93 }; 106 };
94 107
95 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_ 108 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698