Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 29370568: Issue #4692 - Move responsibility for engine reference from tasks to scheduler

Created:
Dec. 31, 2016, 9:44 p.m. by Eric
Modified:
Dec. 31, 2016, 10:47 p.m.
Reviewers:
sergei, Felix Dahlke
Visibility:
Public.

Description

Issue #4692 - Move responsibility for engine reference from tasks to scheduler Move scheduler items from "JsEngine.h", where they are in the public API, to "JsEngineInternal.h", where they are not. As part of this, changed the scheduler member from a PImpl/allocated member of `JsEngine` to as an ordinary member in `JsEngineInternal`. Added abstract base class `TaskFunctionInterface`. This removes the need for the adapter class `HeapFunction`. In addition, this anticipates needing to do more with tasks than simply run them. Added `Task`, an initial version of a proper task class for the scheduler. It contains shared pointers for both the task body and the engine. It has responsibility for allocation of tasks on the heap. The shared pointer to the engine keeps the engine in existence for the duration of the task, taking that responsibility from the task. This removes the last necessity for a task to hold such a shared pointer and thus finally removes any need for engine self-reference. Changed the web request task and the five I/O tasks to use these mechanisms. They all now derive from `TaskFunctionInterface`. The `JsEnginePtr` member in each task was replaced with a plain pointer to `JsEngineInternal`. This removes the last engine self-reference for these tasks.

Patch Set 1 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+175 lines, -121 lines) Patch
M include/AdblockPlus/JsEngine.h View 3 chunks +0 lines, -32 lines 0 comments Download
M src/FileSystemJsObject.cpp View 16 chunks +46 lines, -52 lines 0 comments Download
M src/JsEngine.cpp View 4 chunks +14 lines, -24 lines 0 comments Download
M src/JsEngineInternal.h View 4 chunks +85 lines, -0 lines 0 comments Download
M src/Scheduler.h View 1 chunk +18 lines, -1 line 0 comments Download
M src/WebRequestJsObject.cpp View 6 chunks +10 lines, -11 lines 0 comments Download
M test/BaseJsTest.cpp View 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 1
Eric
Dec. 31, 2016, 10:47 p.m. (2016-12-31 22:47:31 UTC) #1
This change removes the last engine self-reference for the web request task and
the file system I/O tasks, completing #4692 for these tasks. The last remaining
task is for the timer, which requires more extensive changes than the other
tasks.

Powered by Google App Engine
This is Rietveld