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

Unified Diff: cc/surfaces/surface_factory.cc

Issue 2485473003: Remove SurfaceFactory::Create and SurfaceFactory::Destroy (Closed)
Patch Set: surface factory test clean up Created 4 years, 1 month 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 36a79ee9e9ad0557aa92978a661bb961dd56ed6b..846cbbe8c93d796acee59e6ab73e22ad95ee7259 100644
--- a/cc/surfaces/surface_factory.cc
+++ b/cc/surfaces/surface_factory.cc
@@ -26,10 +26,6 @@ SurfaceFactory::SurfaceFactory(const FrameSinkId& frame_sink_id,
weak_factory_(this) {}
SurfaceFactory::~SurfaceFactory() {
- if (!surface_map_.empty()) {
- LOG(ERROR) << "SurfaceFactory has " << surface_map_.size()
- << " entries in map on destruction.";
- }
DestroyAll();
}
@@ -39,6 +35,7 @@ void SurfaceFactory::DestroyAll() {
manager_->Destroy(std::move(pair.second));
}
surface_map_.clear();
+ current_local_frame_id_ = LocalFrameId();
}
void SurfaceFactory::Reset() {
@@ -82,6 +79,11 @@ void SurfaceFactory::SubmitCompositorFrame(const LocalFrameId& local_frame_id,
CompositorFrame frame,
const DrawCallback& callback) {
TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame");
+ DCHECK(local_frame_id.is_valid());
+ if (!current_local_frame_id_.is_valid() ||
+ local_frame_id != current_local_frame_id_) {
+ Create(local_frame_id);
+ }
OwningSurfaceMap::iterator it = surface_map_.find(local_frame_id);
DCHECK(it != surface_map_.end());
DCHECK(it->second->factory().get() == this);
@@ -101,6 +103,10 @@ void SurfaceFactory::SubmitCompositorFrame(const LocalFrameId& local_frame_id,
TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD);
it->second->RunDrawCallbacks();
}
+ if (current_local_frame_id_.is_valid() &&
+ local_frame_id != current_local_frame_id_)
Fady Samuel 2016/11/11 19:02:20 Add braces. Call SetPreviousFrameSurface here befo
+ Destroy(current_local_frame_id_);
+ current_local_frame_id_ = local_frame_id;
}
void SurfaceFactory::RequestCopyOfSurface(

Powered by Google App Engine
This is Rietveld 408576698