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

Side by Side Diff: gpu/command_buffer/service/texture_manager.cc

Issue 1263913002: FREEZE.unindexed Base URL: https://chromium.googlesource.com/chromium/src.git@textures3
Patch Set: Created 5 years, 4 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
« no previous file with comments | « gpu/command_buffer/service/texture_definition.cc ('k') | ui/gfx/gpu_memory_buffer.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 #include "gpu/command_buffer/service/texture_manager.h" 5 #include "gpu/command_buffer/service/texture_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 if (default_textures_[i]) { 2052 if (default_textures_[i]) {
2053 DumpTextureRef(pmd, default_textures_[i].get()); 2053 DumpTextureRef(pmd, default_textures_[i].get());
2054 } 2054 }
2055 } 2055 }
2056 2056
2057 return true; 2057 return true;
2058 } 2058 }
2059 2059
2060 void TextureManager::DumpTextureRef(base::trace_event::ProcessMemoryDump* pmd, 2060 void TextureManager::DumpTextureRef(base::trace_event::ProcessMemoryDump* pmd,
2061 TextureRef* ref) { 2061 TextureRef* ref) {
2062 // TODO(ericrk): Trace image-backed textures. crbug.com/514914
2063 if (ref->texture()->HasImages())
2064 return;
2065
2066 uint32_t size = ref->texture()->estimated_size(); 2062 uint32_t size = ref->texture()->estimated_size();
2067 2063
2068 // Ignore unallocated texture IDs. 2064 // Ignore unallocated texture IDs.
2069 if (size == 0) 2065 if (size == 0)
2070 return; 2066 return;
2071 2067
2072 std::string dump_name = 2068 std::string dump_name =
2073 base::StringPrintf("gl/textures/client_%d/texture_%d", 2069 base::StringPrintf("gl/textures/client_%d/texture_%d",
2074 memory_tracker_->ClientId(), ref->client_id()); 2070 memory_tracker_->ClientId(), ref->client_id());
2071
2072 // TODO(ericrk): GLImage tracing. crbug.com/514914
2073 if (ref->texture()->HasImages()) {
2074 ref->texture()
2075 ->GetLevelImage(GL_TEXTURE_2D, 0)
2076 ->DumpMemory(pmd, memory_tracker_->ClientTracingId(), dump_name);
2077 return;
2078 }
2079
2075 base::trace_event::MemoryAllocatorDump* dump = 2080 base::trace_event::MemoryAllocatorDump* dump =
2076 pmd->CreateAllocatorDump(dump_name); 2081 pmd->CreateAllocatorDump(dump_name);
2077 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 2082 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
2078 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 2083 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
2079 static_cast<uint64_t>(size)); 2084 static_cast<uint64_t>(size));
2080 2085
2081 // Add the |client_guid| which expresses shared ownership with the client 2086 // Add the |client_guid| which expresses shared ownership with the client
2082 // process. 2087 // process.
2083 auto client_guid = gfx::GetGLTextureGUIDForTracing( 2088 auto client_guid = gfx::GetGLTextureGUIDForTracing(
2084 memory_tracker_->ClientTracingId(), ref->client_id()); 2089 memory_tracker_->ClientTracingId(), ref->client_id());
(...skipping 12 matching lines...) Expand all
2097 // The link to the memory tracking |client_id| is given a higher importance 2102 // The link to the memory tracking |client_id| is given a higher importance
2098 // than other refs. 2103 // than other refs.
2099 if (ref == ref->texture()->memory_tracking_ref_) 2104 if (ref == ref->texture()->memory_tracking_ref_)
2100 importance = 2; 2105 importance = 2;
2101 2106
2102 pmd->AddOwnershipEdge(client_guid, service_guid, importance); 2107 pmd->AddOwnershipEdge(client_guid, service_guid, importance);
2103 } 2108 }
2104 2109
2105 } // namespace gles2 2110 } // namespace gles2
2106 } // namespace gpu 2111 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_definition.cc ('k') | ui/gfx/gpu_memory_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698