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

Side by Side Diff: cc/resources/resource_provider.cc

Issue 1587283002: Switch cc to std::unordered_*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@unordered-map
Patch Set: Fix MSVC build issue Created 4 years, 10 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 | « cc/resources/resource_provider.h ('k') | cc/resources/resource_provider_unittest.cc » ('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 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 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 unused.push_back(local_id); 1274 unused.push_back(local_id);
1275 } 1275 }
1276 DeleteAndReturnUnusedResourcesToChild(child_it, NORMAL, unused); 1276 DeleteAndReturnUnusedResourcesToChild(child_it, NORMAL, unused);
1277 } 1277 }
1278 1278
1279 void ResourceProvider::ReceiveReturnsFromParent( 1279 void ResourceProvider::ReceiveReturnsFromParent(
1280 const ReturnedResourceArray& resources) { 1280 const ReturnedResourceArray& resources) {
1281 DCHECK(thread_checker_.CalledOnValidThread()); 1281 DCHECK(thread_checker_.CalledOnValidThread());
1282 GLES2Interface* gl = ContextGL(); 1282 GLES2Interface* gl = ContextGL();
1283 1283
1284 base::hash_map<int, ResourceIdArray> resources_for_child; 1284 std::unordered_map<int, ResourceIdArray> resources_for_child;
1285 1285
1286 for (const ReturnedResource& returned : resources) { 1286 for (const ReturnedResource& returned : resources) {
1287 ResourceId local_id = returned.id; 1287 ResourceId local_id = returned.id;
1288 ResourceMap::iterator map_iterator = resources_.find(local_id); 1288 ResourceMap::iterator map_iterator = resources_.find(local_id);
1289 // Resource was already lost (e.g. it belonged to a child that was 1289 // Resource was already lost (e.g. it belonged to a child that was
1290 // destroyed). 1290 // destroyed).
1291 if (map_iterator == resources_.end()) 1291 if (map_iterator == resources_.end())
1292 continue; 1292 continue;
1293 1293
1294 Resource* resource = &map_iterator->second; 1294 Resource* resource = &map_iterator->second;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 1733
1734 const int kImportance = 2; 1734 const int kImportance = 2;
1735 pmd->CreateSharedGlobalAllocatorDump(guid); 1735 pmd->CreateSharedGlobalAllocatorDump(guid);
1736 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 1736 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
1737 } 1737 }
1738 1738
1739 return true; 1739 return true;
1740 } 1740 }
1741 1741
1742 } // namespace cc 1742 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/resource_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698