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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 142 } |
143 if (!data->memory->memory()) { | 143 if (!data->memory->memory()) { |
144 return scoped_ptr<cc::SharedBitmap>(); | 144 return scoped_ptr<cc::SharedBitmap>(); |
145 } | 145 } |
146 | 146 |
147 return make_scoped_ptr(new HostSharedBitmap( | 147 return make_scoped_ptr(new HostSharedBitmap( |
148 static_cast<uint8*>(data->memory->memory()), data, id, nullptr)); | 148 static_cast<uint8*>(data->memory->memory()), data, id, nullptr)); |
149 } | 149 } |
150 | 150 |
151 bool HostSharedBitmapManager::OnMemoryDump( | 151 bool HostSharedBitmapManager::OnMemoryDump( |
| 152 const base::trace_event::MemoryDumpArgs& args, |
152 base::trace_event::ProcessMemoryDump* pmd) { | 153 base::trace_event::ProcessMemoryDump* pmd) { |
153 base::AutoLock lock(lock_); | 154 base::AutoLock lock(lock_); |
154 | 155 |
155 for (const auto& bitmap : handle_map_) { | 156 for (const auto& bitmap : handle_map_) { |
156 base::trace_event::MemoryAllocatorDump* dump = | 157 base::trace_event::MemoryAllocatorDump* dump = |
157 pmd->CreateAllocatorDump(base::StringPrintf( | 158 pmd->CreateAllocatorDump(base::StringPrintf( |
158 "sharedbitmap/%s", | 159 "sharedbitmap/%s", |
159 base::HexEncode(bitmap.first.name, sizeof(bitmap.first.name)) | 160 base::HexEncode(bitmap.first.name, sizeof(bitmap.first.name)) |
160 .c_str())); | 161 .c_str())); |
161 if (!dump) | 162 if (!dump) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 return handle_map_.size(); | 240 return handle_map_.size(); |
240 } | 241 } |
241 | 242 |
242 void HostSharedBitmapManager::FreeSharedMemoryFromMap( | 243 void HostSharedBitmapManager::FreeSharedMemoryFromMap( |
243 const cc::SharedBitmapId& id) { | 244 const cc::SharedBitmapId& id) { |
244 base::AutoLock lock(lock_); | 245 base::AutoLock lock(lock_); |
245 handle_map_.erase(id); | 246 handle_map_.erase(id); |
246 } | 247 } |
247 | 248 |
248 } // namespace content | 249 } // namespace content |
OLD | NEW |