Bug 131006

Summary: std::bind not compiling with Visual Studio
Product: WebKit Reporter: Alex Christensen <alex.christensen>
Component: Web Template FrameworkAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: agomez, benjamin, calvaris, cgarcia, cmarcelo, commit-queue, eric.carlson, glenn, gustavo, jer.noble, menard, mrobinson, philipj, pnormand, sergio, vjaquez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows 7   
Description Flags
Patch none

Description Alex Christensen 2014-03-31 20:33:55 PDT
I'm getting lots of compile errors like this when compiling after r166496 and I'm trying to avoid adding template parameters everywhere.  This is a shot-in-the dark solution.

1>..\platform\graphics\gstreamer\WebKitWebSourceGStreamer.cpp(745): error C2668: 'WTF::GMainLoopSource::schedule' : ambiguous call to overloaded function
                 C:\Projects\BuildSlave\win-cairo-release\build\WebKitBuild\Release_WinCairo\include\private\wtf/gobject/GMainLoopSource.h(55): could be 'void WTF::GMainLoopSource::schedule(const char *,std::function<bool (GIOCondition)>,GSocket *,GIOCondition,std::function<void (void)>,GMainContext *)'
                 C:\Projects\BuildSlave\win-cairo-release\build\WebKitBuild\Release_WinCairo\include\private\wtf/gobject/GMainLoopSource.h(54): or       'void WTF::GMainLoopSource::schedule(const char *,std::function<bool (void)>,int,std::function<void (void)>,GMainContext *)'
                 C:\Projects\BuildSlave\win-cairo-release\build\WebKitBuild\Release_WinCairo\include\private\wtf/gobject/GMainLoopSource.h(53): or       'void WTF::GMainLoopSource::schedule(const char *,std::function<void (void)>,int,std::function<void (void)>,GMainContext *)'
                 while trying to match the argument list '(const char [32], std::_Bind<true,void,void (__cdecl *const )(WebKitWebSrc *),WebKitWebSrc *&>, int, webKitWebSrcSeekDataCb::<lambda_d0654a0fb2d903f9cc92bf36e3e47024>)'
Comment 1 Alex Christensen 2014-03-31 20:37:03 PDT
Created attachment 228236 [details]
Comment 2 Alex Christensen 2014-03-31 20:50:11 PDT
Created attachment 228238 [details]
Comment 3 Carlos Garcia Campos 2014-04-01 00:28:12 PDT
Comment on attachment 228238 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=228238&action=review

We use the versions with the bool function to decide whether to use g_idle or g_timeout, if you remove the versions receiving a bool function it's impossible to implement a repeating source. I guess the problem with visual studio is that the compiler doesn't know which one to use, so a possible workaround would be to add a cast in the callers, see the discussion here: https://bugs.webkit.org/show_bug.cgi?id=130027#c15

> Source/WTF/ChangeLog:4
> +        [WinCairo] Build fix after r166496.
> +        https://bugs.webkit.org/show_bug.cgi?id=131006

Removing the code that doesn't build for you is not a build fix :-)
Comment 4 Alex Christensen 2014-04-01 13:03:08 PDT
> Removing the code that doesn't build for you is not a build fix :-)
That's why it was a shot in the dark.  I was just hoping that nobody would ever need to use the bool version :)

I added some std::function<void ()> constructors.  I was going to add static_casts, but I think this is a better solution.
Comment 5 Alex Christensen 2014-04-01 13:09:19 PDT
Created attachment 228311 [details]
Comment 6 Carlos Garcia Campos 2014-04-01 23:50:03 PDT
Comment on attachment 228311 [details]

Thanks for confirming that was indeed the problem, and sorry for the build break.
Comment 7 WebKit Commit Bot 2014-04-02 07:28:09 PDT
Comment on attachment 228311 [details]

Clearing flags on attachment: 228311

Committed r166643: <http://trac.webkit.org/changeset/166643>
Comment 8 WebKit Commit Bot 2014-04-02 07:28:15 PDT
All reviewed patches have been landed.  Closing bug.