OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/common/host_shared_bitmap_manager.h" | 5 #include "content/common/host_shared_bitmap_manager.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/trace_event/process_memory_dump.h" | 10 #include "base/trace_event/process_memory_dump.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 if (!data->memory->memory()) { | 145 if (!data->memory->memory()) { |
146 return scoped_ptr<cc::SharedBitmap>(); | 146 return scoped_ptr<cc::SharedBitmap>(); |
147 } | 147 } |
148 | 148 |
149 return make_scoped_ptr(new HostSharedBitmap( | 149 return make_scoped_ptr(new HostSharedBitmap( |
150 static_cast<uint8*>(data->memory->memory()), data, id, nullptr)); | 150 static_cast<uint8*>(data->memory->memory()), data, id, nullptr)); |
151 } | 151 } |
152 | 152 |
153 bool HostSharedBitmapManager::OnMemoryDump( | 153 bool HostSharedBitmapManager::OnMemoryDump( |
| 154 const base::trace_event::MemoryDumpArgs& args, |
154 base::trace_event::ProcessMemoryDump* pmd) { | 155 base::trace_event::ProcessMemoryDump* pmd) { |
155 base::AutoLock lock(lock_); | 156 base::AutoLock lock(lock_); |
156 | 157 |
157 for (const auto& bitmap : handle_map_) { | 158 for (const auto& bitmap : handle_map_) { |
158 base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump( | 159 base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump( |
159 base::StringPrintf("%s/%s", kMemoryAllocatorName, | 160 base::StringPrintf("%s/%s", kMemoryAllocatorName, |
160 base::HexEncode(bitmap.first.name, | 161 base::HexEncode(bitmap.first.name, |
161 sizeof(bitmap.first.name)).c_str())); | 162 sizeof(bitmap.first.name)).c_str())); |
162 if (!dump) | 163 if (!dump) |
163 return false; | 164 return false; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 return handle_map_.size(); | 235 return handle_map_.size(); |
235 } | 236 } |
236 | 237 |
237 void HostSharedBitmapManager::FreeSharedMemoryFromMap( | 238 void HostSharedBitmapManager::FreeSharedMemoryFromMap( |
238 const cc::SharedBitmapId& id) { | 239 const cc::SharedBitmapId& id) { |
239 base::AutoLock lock(lock_); | 240 base::AutoLock lock(lock_); |
240 handle_map_.erase(id); | 241 handle_map_.erase(id); |
241 } | 242 } |
242 | 243 |
243 } // namespace content | 244 } // namespace content |
OLD | NEW |