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

Unified Diff: src/FileSystemJsObject.cpp

Issue 10727002: Get rid of dependencies on v8.h in public header files (Closed)
Patch Set: Added helper class to make using v8 values via auto_ptr less awkward Created May 23, 2013, 4:08 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
===================================================================
--- a/src/FileSystemJsObject.cpp
+++ b/src/FileSystemJsObject.cpp
@@ -17,17 +17,17 @@
#include <AdblockPlus/FileSystem.h>
#include <stdexcept>
#include <sstream>
#include <vector>
#include <AdblockPlus/JsValue.h>
#include "FileSystemJsObject.h"
-#include "Utils.h"
+#include "JsContext.h"
#include "Thread.h"
#include "Utils.h"
using namespace AdblockPlus;
namespace
{
class IoThread : public Thread
@@ -67,17 +67,17 @@ namespace
{
error = e.what();
}
catch (...)
{
error = "Unknown error while reading from " + path;
}
- const JsEngine::Context context(jsEngine);
+ const JsContext context(jsEngine);
JsValuePtr result = jsEngine->NewObject();
result->SetProperty("content", content);
result->SetProperty("error", error);
JsValueList params;
params.push_back(result);
callback->Call(params);
delete this;
}
@@ -108,17 +108,17 @@ namespace
{
error = e.what();
}
catch (...)
{
error = "Unknown error while writing to " + path;
}
- const JsEngine::Context context(jsEngine);
+ const JsContext context(jsEngine);
JsValuePtr errorValue = jsEngine->NewValue(error);
JsValueList params;
params.push_back(errorValue);
callback->Call(params);
delete this;
}
private:
@@ -146,17 +146,17 @@ namespace
{
error = e.what();
}
catch (...)
{
error = "Unknown error while moving " + fromPath + " to " + toPath;
}
- const JsEngine::Context context(jsEngine);
+ const JsContext context(jsEngine);
JsValuePtr errorValue = jsEngine->NewValue(error);
JsValueList params;
params.push_back(errorValue);
callback->Call(params);
delete this;
}
private:
@@ -184,17 +184,17 @@ namespace
{
error = e.what();
}
catch (...)
{
error = "Unknown error while removing " + path;
}
- const JsEngine::Context context(jsEngine);
+ const JsContext context(jsEngine);
JsValuePtr errorValue = jsEngine->NewValue(error);
JsValueList params;
params.push_back(errorValue);
callback->Call(params);
delete this;
}
private:
@@ -223,17 +223,17 @@ namespace
{
error = e.what();
}
catch (...)
{
error = "Unknown error while calling stat on " + path;
}
- const JsEngine::Context context(jsEngine);
+ const JsContext context(jsEngine);
JsValuePtr result = jsEngine->NewObject();
result->SetProperty("exists", statResult.exists);
result->SetProperty("isFile", statResult.isFile);
result->SetProperty("isDirectory", statResult.isDirectory);
result->SetProperty("lastModified", statResult.lastModified);
result->SetProperty("error", error);
JsValueList params;

Powered by Google App Engine
This is Rietveld