| Index: src/JsEngine.cpp |
| =================================================================== |
| --- a/src/JsEngine.cpp |
| +++ b/src/JsEngine.cpp |
| @@ -22,18 +22,10 @@ |
| #include "JsEngineInternal.h" |
| #include "JsEngineTransition.h" |
| #include "JsError.h" |
| -#include "Scheduler.h" |
| #include "Utils.h" |
| #include "WebRequestJsObject.h" |
| -const AdblockPlus::ImmediateSingleUseThreadType AdblockPlus::ImmediateSingleUseThread = {}; |
| - |
| -class AdblockPlus::JsEngine::SchedulerImpl |
| - : public SchedulerT<SingleUseWorker> |
| -{ |
| -public: |
| - SchedulerImpl() {} // = default; |
| -}; |
| +const ImmediateSingleUseThreadType ImmediateSingleUseThread = {}; |
| namespace |
| { |
| @@ -98,8 +90,7 @@ |
| } |
| AdblockPlus::JsEngine::JsEngine(const ScopedV8IsolatePtr& isolate) |
| - : isolate(isolate), |
| - scheduler(new SchedulerImpl()) // TODO: make_unique once available |
| + : isolate(isolate) |
| {} |
| JsEngineInternal::JsEngineInternal(const AdblockPlus::ScopedV8IsolatePtr& isolate) |
| @@ -117,14 +108,14 @@ |
| auto auxiliaryObject = v8::Object::New(); |
| auxiliaryObject->Set(ToV8String("GET"), MakeCallback(::GETCallback)); |
| globalObject->Set(ToV8String("_webRequest"), auxiliaryObject); |
| - // File system I/O |
| - auxiliaryObject = v8::Object::New(); |
| - auxiliaryObject->Set(ToV8String("read"), MakeCallback(::ReadCallback)); |
| - auxiliaryObject->Set(ToV8String("write"), MakeCallback(::WriteCallback)); |
| - auxiliaryObject->Set(ToV8String("move"), MakeCallback(::MoveCallback)); |
| - auxiliaryObject->Set(ToV8String("remove"), MakeCallback(::RemoveCallback)); |
| - auxiliaryObject->Set(ToV8String("stat"), MakeCallback(::StatCallback)); |
| - auxiliaryObject->Set(ToV8String("resolve"), MakeCallback(::ResolveCallback)); |
| + // File system I/O |
| + auxiliaryObject = v8::Object::New(); |
| + auxiliaryObject->Set(ToV8String("read"), MakeCallback(::ReadCallback)); |
| + auxiliaryObject->Set(ToV8String("write"), MakeCallback(::WriteCallback)); |
| + auxiliaryObject->Set(ToV8String("move"), MakeCallback(::MoveCallback)); |
| + auxiliaryObject->Set(ToV8String("remove"), MakeCallback(::RemoveCallback)); |
| + auxiliaryObject->Set(ToV8String("stat"), MakeCallback(::StatCallback)); |
| + auxiliaryObject->Set(ToV8String("resolve"), MakeCallback(::ResolveCallback)); |
| globalObject->Set(ToV8String("_fileSystem"), auxiliaryObject); |
| // TODO: Move the rest of the global object initializations here |
| @@ -382,17 +373,16 @@ |
| global->SetProperty(name, value); |
| } |
| -void AdblockPlus::JsEngine::Schedule(std::function<void()> task, |
| - AdblockPlus::ImmediateSingleUseThreadType) |
| +void JsEngineInternal::ScheduleTaskInternal(std::shared_ptr<TaskFunctionInterface>&& body) |
| { |
| // The present version of the scheduler only does immediate and single-use |
| // It does not, however, detach threads like the legacy thread behavior did. |
| - scheduler->Run(task); |
| + scheduler.Run(Task(this, std::move(body))); |
| } |
| -void AdblockPlus::JsEngine::WaitForQuietScheduler() |
| +void JsEngineInternal::WaitForQuietScheduler() |
| { |
| - scheduler->JoinAll(); |
| + scheduler.JoinAll(); |
| } |
| JsEngineInternal* ToInternal(AdblockPlus::JsEnginePtr p) |