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

Unified Diff: cc/surfaces/surface_factory.cc

Issue 2388753003: Introduce cc::LocalFrameId and use in SurfaceFactory (Closed)
Patch Set: Fix exo_unittests Created 4 years, 2 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
Index: cc/surfaces/surface_factory.cc
diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc
index 5dbc9696ce3d11c1b435797064b540e5941df94e..ed66e1bd31989d7f62fd30eb108304503930c0fb 100644
--- a/cc/surfaces/surface_factory.cc
+++ b/cc/surfaces/surface_factory.cc
@@ -40,17 +40,16 @@ void SurfaceFactory::DestroyAll() {
surface_map_.clear();
}
-void SurfaceFactory::Create(const SurfaceId& surface_id) {
- DCHECK(surface_id.frame_sink_id() == frame_sink_id_);
- std::unique_ptr<Surface> surface(new Surface(surface_id, this));
+void SurfaceFactory::Create(const LocalFrameId& local_frame_id) {
+ std::unique_ptr<Surface> surface(base::MakeUnique<Surface>(
+ SurfaceId(frame_sink_id_, local_frame_id), this));
manager_->RegisterSurface(surface.get());
- DCHECK(!surface_map_.count(surface_id));
- surface_map_[surface_id] = std::move(surface);
+ DCHECK(!surface_map_.count(local_frame_id));
+ surface_map_[local_frame_id] = std::move(surface);
}
-void SurfaceFactory::Destroy(const SurfaceId& surface_id) {
- DCHECK(surface_id.frame_sink_id() == frame_sink_id_);
- OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
+void SurfaceFactory::Destroy(const LocalFrameId& local_frame_id) {
+ OwningSurfaceMap::iterator it = surface_map_.find(local_frame_id);
DCHECK(it != surface_map_.end());
DCHECK(it->second->factory().get() == this);
std::unique_ptr<Surface> surface(std::move(it->second));
@@ -59,50 +58,46 @@ void SurfaceFactory::Destroy(const SurfaceId& surface_id) {
manager_->Destroy(std::move(surface));
}
-void SurfaceFactory::SetPreviousFrameSurface(const SurfaceId& new_id,
- const SurfaceId& old_id) {
- DCHECK(new_id.frame_sink_id() == frame_sink_id_);
- DCHECK(old_id.frame_sink_id() == frame_sink_id_);
+void SurfaceFactory::SetPreviousFrameSurface(const LocalFrameId& new_id,
+ const LocalFrameId& old_id) {
OwningSurfaceMap::iterator it = surface_map_.find(new_id);
DCHECK(it != surface_map_.end());
- Surface* old_surface = manager_->GetSurfaceForId(old_id);
+ Surface* old_surface =
+ manager_->GetSurfaceForId(SurfaceId(frame_sink_id_, old_id));
if (old_surface) {
it->second->SetPreviousFrameSurface(old_surface);
}
}
-void SurfaceFactory::SubmitCompositorFrame(const SurfaceId& surface_id,
+void SurfaceFactory::SubmitCompositorFrame(const LocalFrameId& local_frame_id,
CompositorFrame frame,
const DrawCallback& callback) {
TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame");
- DCHECK(surface_id.frame_sink_id() == frame_sink_id_);
- OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
+ OwningSurfaceMap::iterator it = surface_map_.find(local_frame_id);
DCHECK(it != surface_map_.end());
DCHECK(it->second->factory().get() == this);
it->second->QueueFrame(std::move(frame), callback);
- if (!manager_->SurfaceModified(surface_id)) {
+ if (!manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id))) {
TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD);
it->second->RunDrawCallbacks();
}
}
void SurfaceFactory::RequestCopyOfSurface(
- const SurfaceId& surface_id,
+ const LocalFrameId& local_frame_id,
std::unique_ptr<CopyOutputRequest> copy_request) {
- DCHECK(surface_id.frame_sink_id() == frame_sink_id_);
- OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
+ OwningSurfaceMap::iterator it = surface_map_.find(local_frame_id);
if (it == surface_map_.end()) {
copy_request->SendEmptyResult();
return;
}
DCHECK(it->second->factory().get() == this);
it->second->RequestCopyOfOutput(std::move(copy_request));
- manager_->SurfaceModified(surface_id);
+ manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id));
}
-void SurfaceFactory::WillDrawSurface(const SurfaceId& id,
+void SurfaceFactory::WillDrawSurface(const LocalFrameId& id,
const gfx::Rect& damage_rect) {
- DCHECK(id.frame_sink_id() == frame_sink_id_);
client_->WillDrawSurface(id, damage_rect);
}

Powered by Google App Engine
This is Rietveld 408576698