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

Unified Diff: src/FileSystemJsObject.cpp

Issue 29500602: Issue 5450 - introduce the Platform class (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: rebase Created July 31, 2017, 12:53 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
Index: src/FileSystemJsObject.cpp
diff --git a/src/FileSystemJsObject.cpp b/src/FileSystemJsObject.cpp
index 9ed89769c05518dc5b8e36dc775fa6b459694975..6744d7d820cb84eae2aa410dc3d59ee1b83ad6d2 100644
--- a/src/FileSystemJsObject.cpp
+++ b/src/FileSystemJsObject.cpp
@@ -24,6 +24,7 @@
#include "FileSystemJsObject.h"
#include "JsContext.h"
#include "Utils.h"
+#include <AdblockPlus/Platform.h>
using namespace AdblockPlus;
using AdblockPlus::Utils::ThrowExceptionInJS;
@@ -45,7 +46,7 @@ namespace
values.push_back(converted[1]);
auto weakCallback = jsEngine->StoreJsValues(values);
std::weak_ptr<JsEngine> weakJsEngine = jsEngine;
- jsEngine->GetAsyncFileSystem()->Read(converted[0].AsString(),
+ jsEngine->GetPlatform().GetFileSystem().Read(converted[0].AsString(),
[weakJsEngine, weakCallback]
(IFileSystem::IOBuffer&& content, const std::string& error)
{
@@ -78,7 +79,7 @@ namespace
auto weakCallback = jsEngine->StoreJsValues(values);
std::weak_ptr<JsEngine> weakJsEngine = jsEngine;
auto content = converted[1].AsStringBuffer();
- jsEngine->GetAsyncFileSystem()->Write(converted[0].AsString(),
+ jsEngine->GetPlatform().GetFileSystem().Write(converted[0].AsString(),
content,
[weakJsEngine, weakCallback](const std::string& error)
{
@@ -109,7 +110,7 @@ namespace
values.push_back(converted[2]);
auto weakCallback = jsEngine->StoreJsValues(values);
std::weak_ptr<JsEngine> weakJsEngine = jsEngine;
- jsEngine->GetAsyncFileSystem()->Move(converted[0].AsString(),
+ jsEngine->GetPlatform().GetFileSystem().Move(converted[0].AsString(),
converted[1].AsString(),
[weakJsEngine, weakCallback](const std::string& error)
{
@@ -140,7 +141,7 @@ namespace
values.push_back(converted[1]);
auto weakCallback = jsEngine->StoreJsValues(values);
std::weak_ptr<JsEngine> weakJsEngine = jsEngine;
- jsEngine->GetAsyncFileSystem()->Remove(converted[0].AsString(),
+ jsEngine->GetPlatform().GetFileSystem().Remove(converted[0].AsString(),
[weakJsEngine, weakCallback](const std::string& error)
{
auto jsEngine = weakJsEngine.lock();
@@ -170,7 +171,7 @@ namespace
values.push_back(converted[1]);
auto weakCallback = jsEngine->StoreJsValues(values);
std::weak_ptr<JsEngine> weakJsEngine = jsEngine;
- jsEngine->GetAsyncFileSystem()->Stat(converted[0].AsString(),
+ jsEngine->GetPlatform().GetFileSystem().Stat(converted[0].AsString(),
[weakJsEngine, weakCallback]
(const IFileSystem::StatResult& statResult, const std::string& error)
{
@@ -203,7 +204,7 @@ namespace
if (converted.size() != 1)
return ThrowExceptionInJS(isolate, "_fileSystem.resolve requires 1 parameter");
- std::string resolved = jsEngine->GetAsyncFileSystem()->Resolve(converted[0].AsString());
+ std::string resolved = jsEngine->GetPlatform().GetFileSystem().Resolve(converted[0].AsString());
arguments.GetReturnValue().Set(Utils::ToV8String(isolate, resolved));
}
}
« include/AdblockPlus/Platform.h ('K') | « src/ConsoleJsObject.cpp ('k') | src/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld