Index: ui/compositor/compositor.cc |
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc |
index 148a5bd28c782ebc0a5ebac6fa65742d4d092717..4eaf4c663a89e9942e90062f9f7fe33e4a7fa8f3 100644 |
--- a/ui/compositor/compositor.cc |
+++ b/ui/compositor/compositor.cc |
@@ -162,6 +162,9 @@ Compositor::Compositor(CompositorDelegate* delegate, |
} |
Compositor::~Compositor() { |
+ // Clear out any pending callbacks. |
+ didCommit(); |
piman
2012/07/12 17:42:27
Is this still needed? I figure by the time we get
jonathan.backer
2012/07/13 13:26:24
You're right. There's nothing special. We'll leave
|
+ |
// Don't call |CompositorDelegate::ScheduleDraw| from this point. |
delegate_ = NULL; |
// There's a cycle between |root_web_layer_| and |host_|, which results in |
@@ -170,6 +173,11 @@ Compositor::~Compositor() { |
host_.setRootLayer(NULL); |
if (root_layer_) |
root_layer_->SetCompositor(NULL); |
+ |
+ // Stop all outstanding draws before telling the ContextFactory to tear |
+ // down any contexts that the |host_| may rely upon. |
+ host_.reset(); |
+ |
if (!test_compositor_enabled) |
ContextFactory::GetInstance()->RemoveCompositor(this); |
} |
@@ -292,6 +300,10 @@ bool Compositor::HasObserver(CompositorObserver* observer) { |
return observer_list_.HasObserver(observer); |
} |
+bool Compositor::IsThreaded() const { |
+ return g_compositor_thread != NULL; |
+} |
+ |
void Compositor::OnSwapBuffersPosted() { |
swap_posted_ = true; |
} |
@@ -342,6 +354,14 @@ WebKit::WebGraphicsContext3D* Compositor::createContext3D() { |
void Compositor::didRebindGraphicsContext(bool success) { |
} |
+// Called once per draw in single-threaded compositor mode and potentially |
+// many times between draws in the multi-threaded compositor mode. |
+void Compositor::didCommit() { |
+ FOR_EACH_OBSERVER(CompositorObserver, |
+ observer_list_, |
+ OnCompositingDidCommit(this)); |
+} |
+ |
void Compositor::didCommitAndDrawFrame() { |
// TODO(backer): Plumb through an earlier impl side will start. |
if (g_compositor_thread) |