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

Unified Diff: cc/surfaces/surface_aggregator.h

Issue 2821353002: Use flat_set in SurfaceAggregator. (Closed)
Patch Set: Iterator fix Created 3 years, 8 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 | « no previous file | cc/surfaces/surface_aggregator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_aggregator.h
diff --git a/cc/surfaces/surface_aggregator.h b/cc/surfaces/surface_aggregator.h
index ec69f5d3319f7702056a1f18dc3a3d24580eab83..5fe0c3d724478e81e88021c85921de81a3b2e9f4 100644
--- a/cc/surfaces/surface_aggregator.h
+++ b/cc/surfaces/surface_aggregator.h
@@ -5,12 +5,10 @@
#ifndef CC_SURFACES_SURFACE_AGGREGATOR_H_
#define CC_SURFACES_SURFACE_AGGREGATOR_H_
-#include <map>
#include <memory>
-#include <set>
-#include <unordered_map>
-#include <unordered_set>
+#include "base/containers/flat_map.h"
+#include "base/containers/flat_set.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "cc/quads/draw_quad.h"
@@ -30,7 +28,7 @@ class SurfaceManager;
class CC_SURFACES_EXPORT SurfaceAggregator {
public:
- using SurfaceIndexMap = std::unordered_map<SurfaceId, int, SurfaceIdHash>;
+ using SurfaceIndexMap = base::flat_map<SurfaceId, int>;
SurfaceAggregator(SurfaceManager* manager,
ResourceProvider* provider,
@@ -65,7 +63,7 @@ class CC_SURFACES_EXPORT SurfaceAggregator {
~PrewalkResult();
// This is the set of Surfaces that were referenced by another Surface, but
// not included in a SurfaceDrawQuad.
- std::set<SurfaceId> undrawn_surfaces;
+ base::flat_set<SurfaceId> undrawn_surfaces;
bool may_contain_video = false;
};
@@ -145,9 +143,8 @@ class CC_SURFACES_EXPORT SurfaceAggregator {
// each source (SurfaceId, RenderPass id) to a unified ID namespace that's
// used in the aggregated frame. An entry is removed from the map if it's not
// used for one output frame.
- using RenderPassIdAllocatorMap =
- std::map<std::pair<SurfaceId, int>, RenderPassInfo>;
- RenderPassIdAllocatorMap render_pass_allocator_map_;
+ base::flat_map<std::pair<SurfaceId, int>, RenderPassInfo>
+ render_pass_allocator_map_;
int next_render_pass_id_;
const bool aggregate_only_damaged_;
bool output_is_secure_;
@@ -162,9 +159,7 @@ class CC_SURFACES_EXPORT SurfaceAggregator {
// The id for the final color conversion render pass.
int color_conversion_render_pass_id_ = 0;
- using SurfaceToResourceChildIdMap =
- std::unordered_map<SurfaceId, int, SurfaceIdHash>;
- SurfaceToResourceChildIdMap surface_id_to_resource_child_id_;
+ base::flat_map<SurfaceId, int> surface_id_to_resource_child_id_;
// The following state is only valid for the duration of one Aggregate call
// and is only stored on the class to avoid having to pass through every
@@ -172,8 +167,7 @@ class CC_SURFACES_EXPORT SurfaceAggregator {
// This is the set of surfaces referenced in the aggregation so far, used to
// detect cycles.
- using SurfaceSet = std::set<SurfaceId>;
- SurfaceSet referenced_surfaces_;
+ base::flat_set<SurfaceId> referenced_surfaces_;
// For each Surface used in the last aggregation, gives the frame_index at
// that time.
@@ -181,22 +175,22 @@ class CC_SURFACES_EXPORT SurfaceAggregator {
SurfaceIndexMap contained_surfaces_;
// After surface validation, every Surface in this set is valid.
- std::unordered_set<SurfaceId, SurfaceIdHash> valid_surfaces_;
+ base::flat_set<SurfaceId> valid_surfaces_;
// This is the pass list for the aggregated frame.
RenderPassList* dest_pass_list_;
// This is the set of aggregated pass ids that are affected by filters that
// move pixels.
- std::unordered_set<int> moved_pixel_passes_;
+ base::flat_set<int> moved_pixel_passes_;
// This is the set of aggregated pass ids that are drawn by copy requests, so
// should not have their damage rects clipped to the root damage rect.
- std::unordered_set<int> copy_request_passes_;
+ base::flat_set<int> copy_request_passes_;
// This maps each aggregated pass id to the set of (aggregated) pass ids
// that its RenderPassDrawQuads depend on
- std::unordered_map<int, std::unordered_set<int>> render_pass_dependencies_;
+ base::flat_map<int, base::flat_set<int>> render_pass_dependencies_;
// The root damage rect of the currently-aggregating frame.
gfx::Rect root_damage_rect_;
« no previous file with comments | « no previous file | cc/surfaces/surface_aggregator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698