summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/surfaces/surface_aggregator.cc9
-rw-r--r--cc/surfaces/surface_aggregator.h15
-rw-r--r--cc/surfaces/surface_factory.cc10
-rw-r--r--cc/surfaces/surface_factory.h5
-rw-r--r--cc/surfaces/surface_id.h9
-rw-r--r--cc/surfaces/surface_manager.h5
6 files changed, 26 insertions, 27 deletions
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index d60a217..a25fdce 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -122,11 +122,10 @@ static void UnrefHelper(base::WeakPtr<SurfaceFactory> surface_factory,
RenderPassId SurfaceAggregator::RemapPassId(RenderPassId surface_local_pass_id,
SurfaceId surface_id) {
- RenderPassIdAllocator* allocator = render_pass_allocator_map_.get(surface_id);
- if (!allocator) {
- allocator = new RenderPassIdAllocator(&next_render_pass_id_);
- render_pass_allocator_map_.set(surface_id, make_scoped_ptr(allocator));
- }
+ scoped_ptr<RenderPassIdAllocator>& allocator =
+ render_pass_allocator_map_[surface_id];
+ if (!allocator)
+ allocator.reset(new RenderPassIdAllocator(&next_render_pass_id_));
allocator->AddKnownPass(surface_local_pass_id);
return allocator->Remap(surface_local_pass_id);
}
diff --git a/cc/surfaces/surface_aggregator.h b/cc/surfaces/surface_aggregator.h
index 0b640a9..c280758 100644
--- a/cc/surfaces/surface_aggregator.h
+++ b/cc/surfaces/surface_aggregator.h
@@ -6,6 +6,8 @@
#define CC_SURFACES_SURFACE_AGGREGATOR_H_
#include <set>
+#include <unordered_map>
+#include <unordered_set>
#include "base/containers/hash_tables.h"
#include "base/containers/scoped_ptr_hash_map.h"
@@ -36,7 +38,7 @@ class CC_SURFACES_EXPORT SurfaceAggregatorClient {
class CC_SURFACES_EXPORT SurfaceAggregator {
public:
- typedef base::hash_map<SurfaceId, int> SurfaceIndexMap;
+ using SurfaceIndexMap = std::unordered_map<SurfaceId, int, SurfaceIdHash>;
SurfaceAggregator(SurfaceAggregatorClient* client,
SurfaceManager* manager,
@@ -113,13 +115,16 @@ class CC_SURFACES_EXPORT SurfaceAggregator {
ResourceProvider* provider_;
class RenderPassIdAllocator;
- typedef base::ScopedPtrHashMap<SurfaceId, scoped_ptr<RenderPassIdAllocator>>
- RenderPassIdAllocatorMap;
+ using RenderPassIdAllocatorMap =
+ std::unordered_map<SurfaceId,
+ scoped_ptr<RenderPassIdAllocator>,
+ SurfaceIdHash>;
RenderPassIdAllocatorMap render_pass_allocator_map_;
int next_render_pass_id_;
const bool aggregate_only_damaged_;
- typedef base::hash_map<SurfaceId, int> SurfaceToResourceChildIdMap;
+ using SurfaceToResourceChildIdMap =
+ std::unordered_map<SurfaceId, int, SurfaceIdHash>;
SurfaceToResourceChildIdMap surface_id_to_resource_child_id_;
// The following state is only valid for the duration of one Aggregate call
@@ -137,7 +142,7 @@ class CC_SURFACES_EXPORT SurfaceAggregator {
SurfaceIndexMap contained_surfaces_;
// After surface validation, every Surface in this set is valid.
- base::hash_set<SurfaceId> valid_surfaces_;
+ std::unordered_set<SurfaceId, SurfaceIdHash> valid_surfaces_;
// This is the pass list for the aggregated frame.
RenderPassList* dest_pass_list_;
diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc
index 12afab8..79cb096 100644
--- a/cc/surfaces/surface_factory.cc
+++ b/cc/surfaces/surface_factory.cc
@@ -31,8 +31,8 @@ SurfaceFactory::~SurfaceFactory() {
}
void SurfaceFactory::DestroyAll() {
- for (auto it = surface_map_.begin(); it != surface_map_.end(); ++it)
- manager_->Destroy(surface_map_.take(it));
+ for (auto& pair : surface_map_)
+ manager_->Destroy(std::move(pair.second));
surface_map_.clear();
}
@@ -40,14 +40,16 @@ void SurfaceFactory::Create(SurfaceId surface_id) {
scoped_ptr<Surface> surface(new Surface(surface_id, this));
manager_->RegisterSurface(surface.get());
DCHECK(!surface_map_.count(surface_id));
- surface_map_.add(surface_id, std::move(surface));
+ surface_map_[surface_id] = std::move(surface);
}
void SurfaceFactory::Destroy(SurfaceId surface_id) {
OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
DCHECK(it != surface_map_.end());
DCHECK(it->second->factory().get() == this);
- manager_->Destroy(surface_map_.take_and_erase(it));
+ scoped_ptr<Surface> surface(std::move(it->second));
+ surface_map_.erase(it);
+ manager_->Destroy(std::move(surface));
}
void SurfaceFactory::SetBeginFrameSource(SurfaceId surface_id,
diff --git a/cc/surfaces/surface_factory.h b/cc/surfaces/surface_factory.h
index fdfad17..cd8a0e3 100644
--- a/cc/surfaces/surface_factory.h
+++ b/cc/surfaces/surface_factory.h
@@ -6,6 +6,7 @@
#define CC_SURFACES_SURFACE_FACTORY_H_
#include <set>
+#include <unordered_map>
#include "base/callback_forward.h"
#include "base/containers/scoped_ptr_hash_map.h"
@@ -85,8 +86,8 @@ class CC_SURFACES_EXPORT SurfaceFactory
bool needs_sync_points_;
- typedef base::ScopedPtrHashMap<SurfaceId, scoped_ptr<Surface>>
- OwningSurfaceMap;
+ using OwningSurfaceMap =
+ std::unordered_map<SurfaceId, scoped_ptr<Surface>, SurfaceIdHash>;
OwningSurfaceMap surface_map_;
DISALLOW_COPY_AND_ASSIGN(SurfaceFactory);
diff --git a/cc/surfaces/surface_id.h b/cc/surfaces/surface_id.h
index f43759c..4472c69 100644
--- a/cc/surfaces/surface_id.h
+++ b/cc/surfaces/surface_id.h
@@ -43,13 +43,4 @@ struct SurfaceIdHash {
} // namespace cc
-namespace BASE_HASH_NAMESPACE {
-template <>
-struct hash<cc::SurfaceId> {
- size_t operator()(cc::SurfaceId key) const {
- return hash<uint64_t>()(key.id);
- }
-};
-} // namespace BASE_HASH_NAMESPACE
-
#endif // CC_SURFACES_SURFACE_ID_H_
diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h
index 7466501..d4fc144 100644
--- a/cc/surfaces/surface_manager.h
+++ b/cc/surfaces/surface_manager.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <list>
+#include <unordered_map>
#include <vector>
#include "base/containers/hash_tables.h"
@@ -60,14 +61,14 @@ class CC_SURFACES_EXPORT SurfaceManager {
private:
void GarbageCollectSurfaces();
- typedef base::hash_map<SurfaceId, Surface*> SurfaceMap;
+ using SurfaceMap = std::unordered_map<SurfaceId, Surface*, SurfaceIdHash>;
SurfaceMap surface_map_;
base::ObserverList<SurfaceDamageObserver> observer_list_;
base::ThreadChecker thread_checker_;
// List of surfaces to be destroyed, along with what sequences they're still
// waiting on.
- typedef std::list<Surface*> SurfaceDestroyList;
+ using SurfaceDestroyList = std::list<Surface*>;
SurfaceDestroyList surfaces_to_destroy_;
// Set of SurfaceSequences that have been satisfied by a frame but not yet