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

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

Issue 10270014: Revert 134527 - Revert 134480 - Revert 134428 - GpuMemoryManager suggests values for renderer Conte… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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_command_buffer_stub.cc ('k') | content/common/gpu/gpu_memory_manager.h » ('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_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
15 // Memory Allocation which will be assigned to the renderer context. 16 // Memory Allocation which will be assigned to the renderer context.
16 struct GpuMemoryAllocationForRenderer { 17 struct GpuMemoryAllocationForRenderer {
17 enum { 18 enum {
18 INVALID_RESOURCE_SIZE = -1 19 INVALID_RESOURCE_SIZE = -1
19 }; 20 };
20 21
21 // Exceeding this limit for an unreasonable amount of time may cause context 22 // Exceeding this limit for an unreasonable amount of time may cause context
22 // to be lost. 23 // to be lost.
23 size_t gpu_resource_size_in_bytes; 24 size_t gpu_resource_size_in_bytes;
24 bool suggest_have_backbuffer; 25 bool suggest_have_backbuffer;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 61 }
61 bool operator!=(const GpuMemoryAllocationForBrowser& other) const { 62 bool operator!=(const GpuMemoryAllocationForBrowser& other) const {
62 return !(*this == other); 63 return !(*this == other);
63 } 64 }
64 }; 65 };
65 66
66 // Combination of the above two Memory Allocations which will be created by the 67 // Combination of the above two Memory Allocations which will be created by the
67 // GpuMemoryManager. 68 // GpuMemoryManager.
68 struct GpuMemoryAllocation : public GpuMemoryAllocationForRenderer, 69 struct GpuMemoryAllocation : public GpuMemoryAllocationForRenderer,
69 public GpuMemoryAllocationForBrowser { 70 public GpuMemoryAllocationForBrowser {
70 // Bitmap
71 enum BufferAllocation {
72 kHasNoBuffers = 0,
73 kHasFrontbuffer = 1,
74 kHasBackbuffer = 2
75 };
76
77 GpuMemoryAllocation() 71 GpuMemoryAllocation()
78 : GpuMemoryAllocationForRenderer(), 72 : GpuMemoryAllocationForRenderer(),
79 GpuMemoryAllocationForBrowser() { 73 GpuMemoryAllocationForBrowser() {
80 } 74 }
81 75
82 GpuMemoryAllocation(size_t gpu_resource_size_in_bytes, 76 GpuMemoryAllocation(size_t gpu_resource_size_in_bytes,
83 int allocationBitmap) 77 bool suggest_have_backbuffer,
78 bool suggest_have_frontbuffer)
84 : GpuMemoryAllocationForRenderer(gpu_resource_size_in_bytes, 79 : GpuMemoryAllocationForRenderer(gpu_resource_size_in_bytes,
85 (allocationBitmap & kHasBackbuffer) == kHasBackbuffer), 80 suggest_have_backbuffer),
86 GpuMemoryAllocationForBrowser( 81 GpuMemoryAllocationForBrowser(suggest_have_frontbuffer) {
87 (allocationBitmap & kHasFrontbuffer) == kHasFrontbuffer) {
88 } 82 }
89 83
90 bool operator==(const GpuMemoryAllocation& other) const { 84 bool operator==(const GpuMemoryAllocation& other) const {
91 return static_cast<const GpuMemoryAllocationForRenderer&>(*this) == 85 return static_cast<const GpuMemoryAllocationForRenderer&>(*this) ==
92 static_cast<const GpuMemoryAllocationForRenderer&>(other) && 86 static_cast<const GpuMemoryAllocationForRenderer&>(other) &&
93 static_cast<const GpuMemoryAllocationForBrowser&>(*this) == 87 static_cast<const GpuMemoryAllocationForBrowser&>(*this) ==
94 static_cast<const GpuMemoryAllocationForBrowser&>(other); 88 static_cast<const GpuMemoryAllocationForBrowser&>(other);
95 } 89 }
96 bool operator!=(const GpuMemoryAllocation& other) const { 90 bool operator!=(const GpuMemoryAllocation& other) const {
97 return !(*this == other); 91 return !(*this == other);
98 } 92 }
99 }; 93 };
100 94
101 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_ 95 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.cc ('k') | content/common/gpu/gpu_memory_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698