Index: include/AdblockPlus/Scheduler.h |
diff --git a/src/DefaultWebRequest.cpp b/include/AdblockPlus/Scheduler.h |
similarity index 57% |
copy from src/DefaultWebRequest.cpp |
copy to include/AdblockPlus/Scheduler.h |
index 50af59ae9dd74c92f0a150b61dab721dd60ac786..a0ded9d8c6f2667b672588ca1f3553637a310fa2 100644 |
--- a/src/DefaultWebRequest.cpp |
+++ b/include/AdblockPlus/Scheduler.h |
@@ -15,26 +15,19 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
-#include "DefaultWebRequest.h" |
-#include <thread> |
+#ifndef ADBLOCK_PLUS_SCHEDULER_H |
+#define ADBLOCK_PLUS_SCHEDULER_H |
-using namespace AdblockPlus; |
- |
-DefaultWebRequest::DefaultWebRequest(std::unique_ptr<DefaultWebRequestSync>&& syncImpl) |
- : syncImpl(std::move(syncImpl)) |
+namespace AdblockPlus |
{ |
+ /** |
+ * Task object which can be passed to `Scheduler` to be executed asynchronously. |
+ */ |
+ typedef std::function<void()> SchedulerTask; |
+ /** |
+ * Scheduler object executing tasks asynchronously. |
+ */ |
+ typedef std::function<void(const SchedulerTask&)> Scheduler; |
} |
- |
-DefaultWebRequest::~DefaultWebRequest() |
-{ |
- |
-} |
- |
-void DefaultWebRequest::GET(const std::string& url, const HeaderList& requestHeaders, const GetCallback& getCallback) |
-{ |
- std::thread([this, url, requestHeaders, getCallback] |
- { |
- getCallback(this->syncImpl->GET(url, requestHeaders)); |
- }).detach(); |
-} |
+#endif // ADBLOCK_PLUS_SCHEDULER_H |