Don't call ScheduleDraw from destructor

BUG=127614
TEST=asan bot passes

Review URL: https://chromiumcodereview.appspot.com/10387062

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136377 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 18da91cc..4b23d86 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -145,6 +145,8 @@
 }
 
 Compositor::~Compositor() {
+  // Don't call |CompositorDelegate::ScheduleDraw| from this point.
+  delegate_ = NULL;
   // There's a cycle between |root_web_layer_| and |host_|, which results in
   // leaking and/or crashing. Explicitly set the root layer to NULL so the cycle
   // is broken.
@@ -175,7 +177,7 @@
     // compositeImmediately() directly.
     layout();
     host_.composite();
-  } else {
+  } else if (delegate_) {
     delegate_->ScheduleDraw();
   }
 }