Commit 6934a31e authored by tzik's avatar tzik Committed by Commit Bot

Migrate //gin from base::Callback to base::{Once,Repeating}Callback

This updates //gin to use base::OnceCallback or base::RepeatingCallback
instead of legacy base::Callback. No intended functional change is included.

This reduces the number of 'base::Bind' in //gin from 8 to 1
as tracked at http://goo.gl/LUVhDj

Bug: 714018
Change-Id: I5c4bb758181c09e2d7b0e2fec5c51a4e1eec24bb
Reviewed-on: https://chromium-review.googlesource.com/952646Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541664}
parent 50d82505
......@@ -31,8 +31,9 @@ TEST_F(ArgumentsTest, TestArgumentsHolderCreationContext) {
// |creation_context|.
v8::Local<v8::ObjectTemplate> object_template =
ObjectTemplateBuilder(isolate)
.SetMethod("checkCreationContext",
base::Bind(check_creation_context, creation_context))
.SetMethod(
"checkCreationContext",
base::BindRepeating(check_creation_context, creation_context))
.Build();
v8::Local<v8::Object> object =
......@@ -100,9 +101,12 @@ TEST_F(ArgumentsTest, TestGetAll) {
// |creation_context|.
v8::Local<v8::ObjectTemplate> object_template =
ObjectTemplateBuilder(isolate)
.SetMethod("check1", base::Bind(check_arguments, &list1, &called1))
.SetMethod("check2", base::Bind(check_arguments, &list2, &called2))
.SetMethod("check3", base::Bind(check_arguments, &list3, &called3))
.SetMethod("check1",
base::BindRepeating(check_arguments, &list1, &called1))
.SetMethod("check2",
base::BindRepeating(check_arguments, &list2, &called2))
.SetMethod("check3",
base::BindRepeating(check_arguments, &list3, &called3))
.Build();
v8::Local<v8::Object> object =
......
......@@ -90,7 +90,7 @@ TEST_F(DataObjectBuilderTest, UnusableAfterBuild) {
EXPECT_FALSE(builder.Build().IsEmpty());
bool has_dcheck_failure = false;
logging::ScopedLogAssertHandler handler(base::Bind(
logging::ScopedLogAssertHandler handler(base::BindRepeating(
[](bool* flag, const char* file, int line, base::StringPiece message,
base::StringPiece stack_trace) { *flag = true; },
base::Unretained(&has_dcheck_failure)));
......
......@@ -114,7 +114,8 @@ class MyInterceptor : public Wrappable<MyInterceptor>,
if (!function_template.IsEmpty())
return function_template;
function_template = CreateFunctionTemplate(
isolate, base::Bind(&MyInterceptor::Call), HolderIsFirstArgument);
isolate, base::BindRepeating(&MyInterceptor::Call),
HolderIsFirstArgument);
template_cache_.Set(name, function_template);
return function_template;
}
......
......@@ -102,7 +102,7 @@ int main(int argc, char** argv) {
it != args.end(); ++it) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(gin::Run, runner.GetWeakPtr(), base::FilePath(*it)));
base::BindOnce(gin::Run, runner.GetWeakPtr(), base::FilePath(*it)));
}
base::RunLoop().RunUntilIdle();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment