OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 resource.size, resource.format); | 2170 resource.size, resource.format); |
2171 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 2171 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
2172 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 2172 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
2173 static_cast<uint64_t>(total_bytes)); | 2173 static_cast<uint64_t>(total_bytes)); |
2174 | 2174 |
2175 // Resources may be shared across processes and require a shared GUID to | 2175 // Resources may be shared across processes and require a shared GUID to |
2176 // prevent double counting the memory. | 2176 // prevent double counting the memory. |
2177 base::trace_event::MemoryAllocatorDumpGuid guid; | 2177 base::trace_event::MemoryAllocatorDumpGuid guid; |
2178 switch (resource.type) { | 2178 switch (resource.type) { |
2179 case RESOURCE_TYPE_GPU_MEMORY_BUFFER: | 2179 case RESOURCE_TYPE_GPU_MEMORY_BUFFER: |
2180 guid = gfx::GetGpuMemoryBufferGUIDForTracing( | 2180 guid = |
2181 tracing_process_id, resource.gpu_memory_buffer->GetHandle().id); | 2181 resource.gpu_memory_buffer->GetGUIDForTracing(tracing_process_id); |
2182 break; | 2182 break; |
2183 case RESOURCE_TYPE_GL_TEXTURE: | 2183 case RESOURCE_TYPE_GL_TEXTURE: |
2184 DCHECK(resource.gl_id); | 2184 DCHECK(resource.gl_id); |
2185 guid = gl::GetGLTextureClientGUIDForTracing( | 2185 guid = gl::GetGLTextureClientGUIDForTracing( |
2186 compositor_context_provider_->ContextSupport() | 2186 compositor_context_provider_->ContextSupport() |
2187 ->ShareGroupTracingGUID(), | 2187 ->ShareGroupTracingGUID(), |
2188 resource.gl_id); | 2188 resource.gl_id); |
2189 break; | 2189 break; |
2190 case RESOURCE_TYPE_BITMAP: | 2190 case RESOURCE_TYPE_BITMAP: |
2191 DCHECK(resource.has_shared_bitmap_id); | 2191 DCHECK(resource.has_shared_bitmap_id); |
2192 guid = GetSharedBitmapGUIDForTracing(resource.shared_bitmap_id); | 2192 guid = GetSharedBitmapGUIDForTracing(resource.shared_bitmap_id); |
2193 break; | 2193 break; |
2194 } | 2194 } |
2195 | 2195 |
2196 DCHECK(!guid.empty()); | 2196 DCHECK(!guid.empty()); |
2197 | 2197 |
2198 const int kImportance = 2; | 2198 const int kImportance = 2; |
2199 pmd->CreateSharedGlobalAllocatorDump(guid); | 2199 pmd->CreateSharedGlobalAllocatorDump(guid); |
2200 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 2200 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
2201 } | 2201 } |
2202 | 2202 |
2203 return true; | 2203 return true; |
2204 } | 2204 } |
2205 | 2205 |
2206 } // namespace cc | 2206 } // namespace cc |
OLD | NEW |