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

Side by Side Diff: cc/raster/task_graph_work_queue.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/raster/task_graph_runner.cc ('k') | cc/resources/resource_provider.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/raster/task_graph_work_queue.h" 5 #include "cc/raster/task_graph_work_queue.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 <map> 11 #include <map>
12 #include <unordered_map>
12 #include <utility> 13 #include <utility>
13 14
14 #include "base/trace_event/trace_event.h" 15 #include "base/trace_event/trace_event.h"
15 16
16 namespace cc { 17 namespace cc {
17 namespace { 18 namespace {
18 19
19 bool CompareTaskPriority(const TaskGraphWorkQueue::PrioritizedTask& a, 20 bool CompareTaskPriority(const TaskGraphWorkQueue::PrioritizedTask& a,
20 const TaskGraphWorkQueue::PrioritizedTask& b) { 21 const TaskGraphWorkQueue::PrioritizedTask& b) {
21 // In this system, numerically lower priority is run first. 22 // In this system, numerically lower priority is run first.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 277
277 // Remove namespace if finished running tasks. 278 // Remove namespace if finished running tasks.
278 DCHECK_EQ(0u, task_namespace.completed_tasks.size()); 279 DCHECK_EQ(0u, task_namespace.completed_tasks.size());
279 DCHECK(!HasReadyToRunTasksInNamespace(&task_namespace)); 280 DCHECK(!HasReadyToRunTasksInNamespace(&task_namespace));
280 DCHECK_EQ(0u, task_namespace.running_tasks.size()); 281 DCHECK_EQ(0u, task_namespace.running_tasks.size());
281 namespaces_.erase(it); 282 namespaces_.erase(it);
282 } 283 }
283 284
284 bool TaskGraphWorkQueue::DependencyMismatch(const TaskGraph* graph) { 285 bool TaskGraphWorkQueue::DependencyMismatch(const TaskGraph* graph) {
285 // Value storage will be 0-initialized. 286 // Value storage will be 0-initialized.
286 base::hash_map<const Task*, size_t> dependents; 287 std::unordered_map<const Task*, size_t> dependents;
287 for (const TaskGraph::Edge& edge : graph->edges) 288 for (const TaskGraph::Edge& edge : graph->edges)
288 dependents[edge.dependent]++; 289 dependents[edge.dependent]++;
289 290
290 for (const TaskGraph::Node& node : graph->nodes) { 291 for (const TaskGraph::Node& node : graph->nodes) {
291 if (dependents[node.task] != node.dependencies) 292 if (dependents[node.task] != node.dependencies)
292 return true; 293 return true;
293 } 294 }
294 295
295 return false; 296 return false;
296 } 297 }
297 298
298 } // namespace cc 299 } // namespace cc
OLDNEW
« no previous file with comments | « cc/raster/task_graph_runner.cc ('k') | cc/resources/resource_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698