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

Unified Diff: cc/output/direct_renderer.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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/direct_renderer.cc
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index ede93ab7fcbcd0699c5ba64b841fde026c90919d..72beb18220ef3d84519d0e8e366036b0ec1b1275 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -6,11 +6,10 @@
#include <stddef.h>
+#include <unordered_map>
#include <utility>
#include <vector>
-#include "base/containers/hash_tables.h"
-#include "base/containers/scoped_ptr_hash_map.h"
#include "base/metrics/histogram.h"
#include "base/numerics/safe_conversions.h"
#include "base/trace_event/trace_event.h"
@@ -149,7 +148,8 @@ void DirectRenderer::SetEnlargePassTextureAmountForTesting(
void DirectRenderer::DecideRenderPassAllocationsForFrame(
const RenderPassList& render_passes_in_draw_order) {
- base::hash_map<RenderPassId, gfx::Size> render_passes_in_frame;
+ std::unordered_map<RenderPassId, gfx::Size, RenderPassIdHash>
+ render_passes_in_frame;
for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i)
render_passes_in_frame.insert(std::pair<RenderPassId, gfx::Size>(
render_passes_in_draw_order[i]->id,
@@ -158,15 +158,14 @@ void DirectRenderer::DecideRenderPassAllocationsForFrame(
std::vector<RenderPassId> passes_to_delete;
for (auto pass_iter = render_pass_textures_.begin();
pass_iter != render_pass_textures_.end(); ++pass_iter) {
- base::hash_map<RenderPassId, gfx::Size>::const_iterator it =
- render_passes_in_frame.find(pass_iter->first);
+ auto it = render_passes_in_frame.find(pass_iter->first);
if (it == render_passes_in_frame.end()) {
passes_to_delete.push_back(pass_iter->first);
continue;
}
gfx::Size required_size = it->second;
- ScopedResource* texture = pass_iter->second;
+ ScopedResource* texture = pass_iter->second.get();
DCHECK(texture);
bool size_appropriate = texture->size().width() >= required_size.width() &&
@@ -181,11 +180,11 @@ void DirectRenderer::DecideRenderPassAllocationsForFrame(
render_pass_textures_.erase(passes_to_delete[i]);
for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i) {
- if (!render_pass_textures_.contains(render_passes_in_draw_order[i]->id)) {
+ if (render_pass_textures_.count(render_passes_in_draw_order[i]->id) == 0) {
scoped_ptr<ScopedResource> texture =
ScopedResource::Create(resource_provider_);
- render_pass_textures_.set(render_passes_in_draw_order[i]->id,
- std::move(texture));
+ render_pass_textures_[render_passes_in_draw_order[i]->id] =
+ std::move(texture);
}
}
}
@@ -534,7 +533,7 @@ bool DirectRenderer::UseRenderPass(DrawingFrame* frame,
return true;
}
- ScopedResource* texture = render_pass_textures_.get(render_pass->id);
+ ScopedResource* texture = render_pass_textures_[render_pass->id].get();
DCHECK(texture);
gfx::Size size = RenderPassTextureSize(render_pass);
@@ -558,8 +557,8 @@ bool DirectRenderer::UseRenderPass(DrawingFrame* frame,
}
bool DirectRenderer::HasAllocatedResourcesForTesting(RenderPassId id) const {
- ScopedResource* texture = render_pass_textures_.get(id);
- return texture && texture->id();
+ auto iter = render_pass_textures_.find(id);
+ return iter != render_pass_textures_.end() && iter->second->id();
}
// static
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698