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

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

Issue 10915293: Simplify tracing of gpu memory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nitfix Created 8 years, 3 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 | « gpu/command_buffer/service/texture_manager.cc ('k') | no next file » | 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/transfer_buffer_manager.h" 5 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 // If it could be mapped, allocate an ID and register the shared memory with 74 // If it could be mapped, allocate an ID and register the shared memory with
75 // that ID. 75 // that ID.
76 Buffer buffer; 76 Buffer buffer;
77 buffer.ptr = duped_shared_memory->memory(); 77 buffer.ptr = duped_shared_memory->memory();
78 buffer.size = size; 78 buffer.size = size;
79 buffer.shared_memory = duped_shared_memory.release(); 79 buffer.shared_memory = duped_shared_memory.release();
80 80
81 shared_memory_bytes_allocated_ += size; 81 shared_memory_bytes_allocated_ += size;
82 TRACE_COUNTER_ID1( 82 TRACE_COUNTER_ID1(
83 "CommandBuffer", "SharedMemory", this, shared_memory_bytes_allocated_); 83 "gpu", "GpuTransferBufferMemory", this, shared_memory_bytes_allocated_);
84 84
85 // If caller requested specific id, first try to use id_request. 85 // If caller requested specific id, first try to use id_request.
86 if (id_request != -1) { 86 if (id_request != -1) {
87 int32 cur_size = static_cast<int32>(registered_objects_.size()); 87 int32 cur_size = static_cast<int32>(registered_objects_.size());
88 if (cur_size <= id_request) { 88 if (cur_size <= id_request) {
89 // Pad registered_objects_ to reach id_request. 89 // Pad registered_objects_ to reach id_request.
90 registered_objects_.resize(static_cast<size_t>(id_request + 1)); 90 registered_objects_.resize(static_cast<size_t>(id_request + 1));
91 for (int32 id = cur_size; id < id_request; ++id) 91 for (int32 id = cur_size; id < id_request; ++id)
92 unused_registered_object_elements_.insert(id); 92 unused_registered_object_elements_.insert(id);
93 registered_objects_[id_request] = buffer; 93 registered_objects_[id_request] = buffer;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 return Buffer(); 146 return Buffer();
147 147
148 if (static_cast<size_t>(handle) >= registered_objects_.size()) 148 if (static_cast<size_t>(handle) >= registered_objects_.size())
149 return Buffer(); 149 return Buffer();
150 150
151 return registered_objects_[handle]; 151 return registered_objects_[handle];
152 } 152 }
153 153
154 } // namespace gpu 154 } // namespace gpu
155 155
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698