| 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> |
| 11 #include <limits> | 11 #include <limits> |
| 12 #include <unordered_map> |
| 12 | 13 |
| 13 #include "base/atomic_sequence_num.h" | 14 #include "base/atomic_sequence_num.h" |
| 14 #include "base/containers/hash_tables.h" | |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/numerics/safe_math.h" | 17 #include "base/numerics/safe_math.h" |
| 18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 19 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 22 #include "base/thread_task_runner_handle.h" | 22 #include "base/thread_task_runner_handle.h" |
| 23 #include "base/trace_event/memory_dump_manager.h" | 23 #include "base/trace_event/memory_dump_manager.h" |
| 24 #include "base/trace_event/trace_event.h" | 24 #include "base/trace_event/trace_event.h" |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 unused.push_back(local_id); | 1266 unused.push_back(local_id); |
| 1267 } | 1267 } |
| 1268 DeleteAndReturnUnusedResourcesToChild(child_it, NORMAL, unused); | 1268 DeleteAndReturnUnusedResourcesToChild(child_it, NORMAL, unused); |
| 1269 } | 1269 } |
| 1270 | 1270 |
| 1271 void ResourceProvider::ReceiveReturnsFromParent( | 1271 void ResourceProvider::ReceiveReturnsFromParent( |
| 1272 const ReturnedResourceArray& resources) { | 1272 const ReturnedResourceArray& resources) { |
| 1273 DCHECK(thread_checker_.CalledOnValidThread()); | 1273 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1274 GLES2Interface* gl = ContextGL(); | 1274 GLES2Interface* gl = ContextGL(); |
| 1275 | 1275 |
| 1276 base::hash_map<int, ResourceIdArray> resources_for_child; | 1276 std::unordered_map<int, ResourceIdArray> resources_for_child; |
| 1277 | 1277 |
| 1278 for (const ReturnedResource& returned : resources) { | 1278 for (const ReturnedResource& returned : resources) { |
| 1279 ResourceId local_id = returned.id; | 1279 ResourceId local_id = returned.id; |
| 1280 ResourceMap::iterator map_iterator = resources_.find(local_id); | 1280 ResourceMap::iterator map_iterator = resources_.find(local_id); |
| 1281 // Resource was already lost (e.g. it belonged to a child that was | 1281 // Resource was already lost (e.g. it belonged to a child that was |
| 1282 // destroyed). | 1282 // destroyed). |
| 1283 if (map_iterator == resources_.end()) | 1283 if (map_iterator == resources_.end()) |
| 1284 continue; | 1284 continue; |
| 1285 | 1285 |
| 1286 Resource* resource = &map_iterator->second; | 1286 Resource* resource = &map_iterator->second; |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 const int kImportance = 2; | 1702 const int kImportance = 2; |
| 1703 pmd->CreateSharedGlobalAllocatorDump(guid); | 1703 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 1704 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 1704 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 1705 } | 1705 } |
| 1706 } | 1706 } |
| 1707 | 1707 |
| 1708 return true; | 1708 return true; |
| 1709 } | 1709 } |
| 1710 | 1710 |
| 1711 } // namespace cc | 1711 } // namespace cc |
| OLD | NEW |