Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(945)

Unified Diff: third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp

Issue 2093603002: Wrap non-GCed raw pointer parameters of WTF::bind with WTF::unretained (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@unretained_wrapper
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp
diff --git a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp
index fcb6d78c46d49f5dafcb448d8691aa5ded1dbf48..fa486149b6b4d27a33926214e9a7b76dd0d21082 100644
--- a/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp
+++ b/third_party/WebKit/Source/platform/scheduler/CancellableTaskFactoryTest.cpp
@@ -102,7 +102,7 @@ void AddOne(int* ptr)
TEST_F(CancellableTaskFactoryTest, Run_ClosureIsExecuted)
{
int executionCount = 0;
- TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount));
+ TestCancellableTaskFactory factory(WTF::bind(&AddOne, WTF::unretained(&executionCount)));
std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate());
task->run();
@@ -112,7 +112,7 @@ TEST_F(CancellableTaskFactoryTest, Run_ClosureIsExecuted)
TEST_F(CancellableTaskFactoryTest, Run_ClosureIsExecutedOnlyOnce)
{
int executionCount = 0;
- TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount));
+ TestCancellableTaskFactory factory(WTF::bind(&AddOne, WTF::unretained(&executionCount)));
std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate());
task->run();
task->run();
@@ -127,7 +127,7 @@ TEST_F(CancellableTaskFactoryTest, Run_FactoryDestructionPreventsExecution)
int executionCount = 0;
std::unique_ptr<WebTaskRunner::Task> task;
{
- TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount));
+ TestCancellableTaskFactory factory(WTF::bind(&AddOne, WTF::unretained(&executionCount)));
task = wrapUnique(factory.cancelAndCreate());
}
task->run();
@@ -138,7 +138,7 @@ TEST_F(CancellableTaskFactoryTest, Run_FactoryDestructionPreventsExecution)
TEST_F(CancellableTaskFactoryTest, Run_TasksInSequence)
{
int executionCount = 0;
- TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount));
+ TestCancellableTaskFactory factory(WTF::bind(&AddOne, WTF::unretained(&executionCount)));
std::unique_ptr<WebTaskRunner::Task> taskA = wrapUnique(factory.cancelAndCreate());
taskA->run();
@@ -156,7 +156,7 @@ TEST_F(CancellableTaskFactoryTest, Run_TasksInSequence)
TEST_F(CancellableTaskFactoryTest, Cancel)
{
int executionCount = 0;
- TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount));
+ TestCancellableTaskFactory factory(WTF::bind(&AddOne, WTF::unretained(&executionCount)));
std::unique_ptr<WebTaskRunner::Task> task = wrapUnique(factory.cancelAndCreate());
factory.cancel();
task->run();
@@ -167,7 +167,7 @@ TEST_F(CancellableTaskFactoryTest, Cancel)
TEST_F(CancellableTaskFactoryTest, CreatingANewTaskCancelsPreviousOnes)
{
int executionCount = 0;
- TestCancellableTaskFactory factory(WTF::bind(&AddOne, &executionCount));
+ TestCancellableTaskFactory factory(WTF::bind(&AddOne, WTF::unretained(&executionCount)));
std::unique_ptr<WebTaskRunner::Task> taskA = wrapUnique(factory.cancelAndCreate());
std::unique_ptr<WebTaskRunner::Task> taskB = wrapUnique(factory.cancelAndCreate());

Powered by Google App Engine
This is Rietveld 408576698