Title: [170616] trunk/Source/WebCore
- Revision
- 170616
- Author
- [email protected]
- Date
- 2014-06-30 17:04:11 -0700 (Mon, 30 Jun 2014)
Log Message
Avoid copying function object in lambda function in ScrollingThread::dispatchBarrier(); actually use move semantics
https://bugs.webkit.org/show_bug.cgi?id=134470
Reviewed by Anders Carlsson.
Currently we always copy construct the captured std::function object when calling callOnMainThread()
in the lambda function created in ScrollingThread::dispatchBarrier() because captured variables are
const in a lambda _expression_'s body by default. That is, the std::function object is captured as const.
Instead, we should mark this lambda _expression_ as mutable so the captured std::function object is
non-const and hence we can use move semantics when passing it to callOnMainThread().
* page/scrolling/ScrollingThread.cpp:
(WebCore::ScrollingThread::dispatchBarrier):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (170615 => 170616)
--- trunk/Source/WebCore/ChangeLog 2014-07-01 00:00:27 UTC (rev 170615)
+++ trunk/Source/WebCore/ChangeLog 2014-07-01 00:04:11 UTC (rev 170616)
@@ -1,3 +1,19 @@
+2014-06-30 Daniel Bates <[email protected]>
+
+ Avoid copying function object in lambda function in ScrollingThread::dispatchBarrier(); actually use move semantics
+ https://bugs.webkit.org/show_bug.cgi?id=134470
+
+ Reviewed by Anders Carlsson.
+
+ Currently we always copy construct the captured std::function object when calling callOnMainThread()
+ in the lambda function created in ScrollingThread::dispatchBarrier() because captured variables are
+ const in a lambda _expression_'s body by default. That is, the std::function object is captured as const.
+ Instead, we should mark this lambda _expression_ as mutable so the captured std::function object is
+ non-const and hence we can use move semantics when passing it to callOnMainThread().
+
+ * page/scrolling/ScrollingThread.cpp:
+ (WebCore::ScrollingThread::dispatchBarrier):
+
2014-06-30 Anders Carlsson <[email protected]>
Adopt the legacy session decoding inside WebPage::restoreSession for now
Modified: trunk/Source/WebCore/page/scrolling/ScrollingThread.cpp (170615 => 170616)
--- trunk/Source/WebCore/page/scrolling/ScrollingThread.cpp 2014-07-01 00:00:27 UTC (rev 170615)
+++ trunk/Source/WebCore/page/scrolling/ScrollingThread.cpp 2014-07-01 00:04:11 UTC (rev 170616)
@@ -60,7 +60,7 @@
void ScrollingThread::dispatchBarrier(std::function<void ()> function)
{
- dispatch([function]{
+ dispatch([function]() mutable {
callOnMainThread(std::move(function));
});
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes