BackgroundHTMLParser::sendTokensToMainThread should use bind
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2013 22:15:54 +0000 (22:15 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2013 22:15:54 +0000 (22:15 +0000)
commit96ab0b22c9e516bb79e997e3a4e1ae5969e420b1
tree52269e25ed2b7daecb35d2ff4decc39ebeb0280f
parent3d32297b363d82b564d99be224636758f6abd890
BackgroundHTMLParser::sendTokensToMainThread should use bind
https://bugs.webkit.org/show_bug.cgi?id=107637

Reviewed by Eric Seidel.

Source/WebCore:

This patch replaces our hand-written implementation of bind for
didReceiveTokensFromBackgroundParser with bind from Functional.h. To
use the generic version of bind, we need to switch to using WeakPtr to
hold a reference to the main thread parser in the BackgroundHTMLParser.

* html/parser/BackgroundHTMLParser.cpp:
(WebCore::BackgroundHTMLParser::BackgroundHTMLParser):
(WebCore::BackgroundHTMLParser::sendTokensToMainThread):
(WebCore::BackgroundHTMLParser::createPartial):
* html/parser/BackgroundHTMLParser.h:
(WebCore::BackgroundHTMLParser::create):
(BackgroundHTMLParser):
(ParserMap):
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::HTMLDocumentParser):
(WebCore::HTMLDocumentParser::startBackgroundParser):
(WebCore::HTMLDocumentParser::stopBackgroundParser):
* html/parser/HTMLDocumentParser.h:
(HTMLDocumentParser):

Source/WTF:

* wtf/Functional.h:
    - I had to re-work the approach to validating WeakPtr |this|
      arguments a bit. Previously you couldn't pass a WeakPtr as a
      non-|this| argument to a function because we would try to unwrap
      it into a raw pointer.
* wtf/WeakPtr.h:
(WTF::WeakPtrFactory::revokeAll):
(WeakPtrFactory):
    - Let clients revoke all outstanding WeakPtrs without needing to
      destroy the WeakPtrFactory.
* wtf/chromium/MainThreadChromium.cpp:
(WTF::callFunctionObject):
(WTF::callOnMainThread):
    - Implement callOnMainThread for Function objects. The non-Chromium
      implementation of MainThread.cpp already implements this feature.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/Functional.h
Source/WTF/wtf/WeakPtr.h
Source/WTF/wtf/chromium/MainThreadChromium.cpp
Source/WebCore/ChangeLog
Source/WebCore/html/parser/BackgroundHTMLParser.cpp
Source/WebCore/html/parser/BackgroundHTMLParser.h
Source/WebCore/html/parser/HTMLDocumentParser.cpp
Source/WebCore/html/parser/HTMLDocumentParser.h