|
Issue #4711 - Rewrite legacy thread facilities
Remove classes `Thread`, `Mutex`, and `Lock` and all tests for them. Remove
all associated files. Replace `AdblockPlus::Sleep()` with
`std::this_thread::sleep_for()`.
Separate concerns by unlinking task specification, memory allocation, and
scheduling. Add class `Scheduler`, which runs tasks with the same policy as
before, namely, run immediately in a single-use thread. This scheduler is
intended to be tranistory.
Replace derivation from class `Thread` with writing tasks as function objects.
In practice all this means is renaming old `Run` functions to `operator()`.
Rename all names "...Thread" to "...Task".
Improve memory handling for tasks by using `shared_ptr` instead of raw `new`
and `delete`. Introduce adapter class `HeapFunction` to replicate the existing
pattern of memory allocation. Add utility function `MakeHeapFunction`.
Total comments: 13
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+209 lines, -379 lines) |
Patch |
|
M |
libadblockplus.gyp
|
View
|
|
2 chunks |
+1 line, -2 lines |
0 comments
|
Download
|
|
M |
src/FileSystemJsObject.cpp
|
View
|
|
10 chunks |
+41 lines, -38 lines |
0 comments
|
Download
|
|
M |
src/FilterEngine.cpp
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/GlobalJsObject.cpp
|
View
|
|
4 chunks |
+12 lines, -14 lines |
1 comment
|
Download
|
|
A |
src/Scheduler.h
|
View
|
|
1 chunk |
+78 lines, -0 lines |
6 comments
|
Download
|
|
A |
src/Scheduler.cpp
|
View
|
|
1 chunk |
+38 lines, -0 lines |
3 comments
|
Download
|
|
R |
src/Thread.h
|
View
|
|
1 chunk |
+0 lines, -76 lines |
3 comments
|
Download
|
|
R |
src/Thread.cpp
|
View
|
|
1 chunk |
+0 lines, -113 lines |
0 comments
|
Download
|
|
M |
src/WebRequestJsObject.cpp
|
View
|
|
4 chunks |
+8 lines, -8 lines |
0 comments
|
Download
|
|
M |
test/BaseJsTest.h
|
View
|
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
test/FileSystemJsObject.cpp
|
View
|
|
8 chunks |
+9 lines, -10 lines |
0 comments
|
Download
|
|
M |
test/FilterEngine.cpp
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
test/GlobalJsObject.cpp
|
View
|
|
4 chunks |
+3 lines, -4 lines |
0 comments
|
Download
|
|
M |
test/Prefs.cpp
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
R |
test/Thread.cpp
|
View
|
|
1 chunk |
+0 lines, -95 lines |
0 comments
|
Download
|
|
M |
test/UpdateCheck.cpp
|
View
|
|
6 chunks |
+6 lines, -6 lines |
0 comments
|
Download
|
|
M |
test/WebRequest.cpp
|
View
|
|
5 chunks |
+4 lines, -5 lines |
0 comments
|
Download
|
Total messages: 19
|