]> khamidou — GitHub mirrors - electron.git/commitdiff
Delay the call of element resize callback to next tick
authorCheng Zhao <zcbenz@gmail.com>
Mon, 10 Aug 2015 03:56:42 +0000 (11:56 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 10 Aug 2015 03:56:42 +0000 (11:56 +0800)
atom/renderer/guest_view_container.cc

index 638df2177e4896b9745a6d1536a99dc2d42a4fe1..7643f72b0e5b9f7270e0b5582368b7531fd45677 100644 (file)
@@ -7,6 +7,7 @@
 #include <map>
 
 #include "base/lazy_instance.h"
+#include "ui/gfx/geometry/size.h"
 
 namespace atom {
 
@@ -51,7 +52,9 @@ void GuestViewContainer::DidResizeElement(const gfx::Size& old_size,
   if (element_resize_callback_.is_null())
     return;
 
-  element_resize_callback_.Run(old_size, new_size);
+  base::MessageLoop::current()->PostTask(
+      FROM_HERE,
+      base::Bind(element_resize_callback_, old_size, new_size));
 }
 
 }  // namespace atom