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

Unified Diff: src/DefaultWebRequest.cpp

Issue 29428650: Issue 5180 - introduce asynchronous web request (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created May 3, 2017, 2:21 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « libadblockplus.gyp ('k') | src/DefaultWebRequestCurl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+}
« no previous file with comments | « libadblockplus.gyp ('k') | src/DefaultWebRequestCurl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld