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

Unified Diff: components/exo/surface.cc

Issue 2476033002: exo: Remove begin frame observer correctly. (Closed)
Patch Set: v2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/surface.cc
diff --git a/components/exo/surface.cc b/components/exo/surface.cc
index e90ee54504e5c7256c8a835e04d6e68bd5e66fde..7bec786df4de698989671706eb84e3345437c127 100644
--- a/components/exo/surface.cc
+++ b/components/exo/surface.cc
@@ -245,7 +245,7 @@ Surface::~Surface() {
for (const auto& frame_callback : active_frame_callbacks_)
frame_callback.Run(base::TimeTicks());
- if (begin_frame_source_)
+ if (begin_frame_source_ && needs_begin_frame_)
begin_frame_source_->RemoveObserver(this);
if (!local_frame_id_.is_null())
@@ -622,6 +622,10 @@ void Surface::WillDraw() {
}
void Surface::SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) {
+ if (begin_frame_source_ && needs_begin_frame_) {
+ begin_frame_source_->RemoveObserver(this);
+ needs_begin_frame_ = false;
+ }
begin_frame_source_ = begin_frame_source;
UpdateNeedsBeginFrame();
}
@@ -843,10 +847,8 @@ void Surface::UpdateSurface(bool full_damage) {
}
void Surface::UpdateNeedsBeginFrame() {
- if (!begin_frame_source_) {
- needs_begin_frame_ = false;
+ if (!begin_frame_source_)
return;
- }
bool needs_begin_frame = !active_frame_callbacks_.empty();
if (needs_begin_frame == needs_begin_frame_)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698