From: Cheng Zhao Date: Wed, 12 Aug 2015 15:14:20 +0000 (+0800) Subject: Don't use C++11 to not crash VS X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78171e2072e5f1fc3797f561cfee5b8d7183fe70;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Don't use C++11 to not crash VS --- diff --git a/atom/browser/net/js_asker.cc b/atom/browser/net/js_asker.cc index 487033d..b170275 100644 --- a/atom/browser/net/js_asker.cc +++ b/atom/browser/net/js_asker.cc @@ -54,22 +54,20 @@ void HandlerCallback(v8::Isolate* isolate, base::Bind(holder->callback, true, base::Passed(&options))); } -// func.bind(func, ...). -template +// func.bind(func, arg1, arg2). +// NB(zcbenz): Using C++11 version crashes VS. v8::Local BindFunctionWith(v8::Isolate* isolate, v8::Local context, v8::Local func, - ArgTypes... args) { + v8::Local arg1, + v8::Local arg2) { v8::MaybeLocal bind = func->Get(mate::StringToV8(isolate, "bind")); CHECK(!bind.IsEmpty()); v8::Local bind_func = v8::Local::Cast(bind.ToLocalChecked()); - std::vector> converted = { - v8::Local::Cast(func), - mate::ConvertToV8(isolate, args)..., - }; + v8::Local converted[] = { func, arg1, arg2 }; return bind_func->Call( - context, func, converted.size(), &converted.front()).ToLocalChecked(); + context, func, arraysize(converted), converted).ToLocalChecked(); } // Generate the callback that will be passed to |handler|. @@ -86,8 +84,7 @@ v8::MaybeLocal GenerateCallback(v8::Isolate* isolate, v8::Local::New(isolate, g_handler_callback_); CallbackHolder* holder = new CallbackHolder; holder->callback = callback; - return BindFunctionWith(isolate, context, - handler_callback->GetFunction(), + return BindFunctionWith(isolate, context, handler_callback->GetFunction(), v8::External::New(isolate, holder), v8::Object::New(isolate)); }