Index: src/DefaultWebRequest.cpp |
diff --git a/test/BaseJsTest.cpp b/src/DefaultWebRequest.cpp |
similarity index 56% |
copy from test/BaseJsTest.cpp |
copy to src/DefaultWebRequest.cpp |
index 6cc94f5aff07287500de8cd87e7c4c47991ffa4f..c5cb7320c22f2c80d4061026bab314bffb4e4b0f 100644 |
--- a/test/BaseJsTest.cpp |
+++ b/src/DefaultWebRequest.cpp |
@@ -15,10 +15,27 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
-#include "BaseJsTest.h" |
+#include <AdblockPlus/DefaultWebRequest.h> |
+#include <thread> |
-AdblockPlus::JsEnginePtr CreateJsEngine(const AdblockPlus::AppInfo& appInfo) |
+using namespace AdblockPlus; |
+ |
+DefaultWebRequest::DefaultWebRequest(const WebRequestSharedPtr& syncImpl) |
+ : syncImpl(syncImpl) |
+{ |
+ |
+} |
+ |
+DefaultWebRequest::~DefaultWebRequest() |
{ |
- static AdblockPlus::ScopedV8IsolatePtr isolate = std::make_shared<AdblockPlus::ScopedV8Isolate>(); |
- return AdblockPlus::JsEngine::New(appInfo, AdblockPlus::CreateDefaultTimer(), isolate); |
+ |
} |
+ |
+void DefaultWebRequest::GET(const std::string& url, const HeaderList& requestHeaders, const GetCallback& getCallback) |
+{ |
+ auto syncImplCapture = syncImpl; |
+ std::thread([syncImplCapture, url, requestHeaders, getCallback] |
+ { |
+ getCallback(syncImplCapture->GET(url, requestHeaders)); |
+ }).detach(); |
+} |