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

Unified Diff: src/ConsoleJsObject.cpp

Issue 4949583905947648: Issue 1280 - Update v8, the second part (Closed)
Patch Set: Created Oct. 27, 2014, 10:01 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 | « shell/src/Main.cpp ('k') | src/FileSystemJsObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ConsoleJsObject.cpp
===================================================================
--- a/src/ConsoleJsObject.cpp
+++ b/src/ConsoleJsObject.cpp
@@ -25,12 +25,12 @@
namespace
{
- v8::Handle<v8::Value> DoLog(AdblockPlus::LogSystem::LogLevel logLevel,
- const v8::Arguments& arguments)
+ void DoLog(AdblockPlus::LogSystem::LogLevel logLevel,
+ const v8::FunctionCallbackInfo<v8::Value>& info)
{
- AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(arguments);
- const AdblockPlus::JsContext context(jsEngine);
- AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments);
+ AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(info);
+ const AdblockPlus::JsContext context{*jsEngine};
+ AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(info);
std::stringstream message;
for (size_t i = 0; i < converted.size(); i++)
@@ -41,48 +41,49 @@
}
std::stringstream source;
- v8::Local<v8::StackFrame> frame = v8::StackTrace::CurrentStackTrace(1)->GetFrame(0);
+ auto isolate = info.GetIsolate();
+ v8::Local<v8::StackFrame> frame = v8::StackTrace::CurrentStackTrace(isolate, /*frame limit*/1)->GetFrame(0);
source << AdblockPlus::Utils::FromV8String(frame->GetScriptName());
source << ":" << frame->GetLineNumber();
AdblockPlus::LogSystemPtr callback = jsEngine->GetLogSystem();
(*callback)(logLevel, message.str(), source.str());
- return v8::Undefined();
}
- v8::Handle<v8::Value> LogCallback(const v8::Arguments& arguments)
+ void LogCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- return DoLog(AdblockPlus::LogSystem::LOG_LEVEL_LOG, arguments);
+ DoLog(AdblockPlus::LogSystem::LOG_LEVEL_LOG, info);
}
- v8::Handle<v8::Value> DebugCallback(const v8::Arguments& arguments)
+ void DebugCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- return DoLog(AdblockPlus::LogSystem::LOG_LEVEL_LOG, arguments);
+ DoLog(AdblockPlus::LogSystem::LOG_LEVEL_LOG, info);
}
- v8::Handle<v8::Value> InfoCallback(const v8::Arguments& arguments)
+ void InfoCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- return DoLog(AdblockPlus::LogSystem::LOG_LEVEL_INFO, arguments);
+ DoLog(AdblockPlus::LogSystem::LOG_LEVEL_INFO, info);
}
- v8::Handle<v8::Value> WarnCallback(const v8::Arguments& arguments)
+ void WarnCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- return DoLog(AdblockPlus::LogSystem::LOG_LEVEL_WARN, arguments);
+ DoLog(AdblockPlus::LogSystem::LOG_LEVEL_WARN, info);
}
- v8::Handle<v8::Value> ErrorCallback(const v8::Arguments& arguments)
+ void ErrorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- return DoLog(AdblockPlus::LogSystem::LOG_LEVEL_ERROR, arguments);
+ DoLog(AdblockPlus::LogSystem::LOG_LEVEL_ERROR, info);
}
- v8::Handle<v8::Value> TraceCallback(const v8::Arguments& arguments)
+ void TraceCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(arguments);
- const AdblockPlus::JsContext context(jsEngine);
- AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments);
+ AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(info);
+ const AdblockPlus::JsContext context{*jsEngine};
+ AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(info);
std::stringstream traceback;
- v8::Local<v8::StackTrace> frames = v8::StackTrace::CurrentStackTrace(100);
+ auto isolate = info.GetIsolate();
+ v8::Local<v8::StackTrace> frames = v8::StackTrace::CurrentStackTrace(isolate, /*frame limit*/100);
for (int i = 0, l = frames->GetFrameCount(); i < l; i++)
{
v8::Local<v8::StackFrame> frame = frames->GetFrame(i);
@@ -100,7 +101,6 @@
AdblockPlus::LogSystemPtr callback = jsEngine->GetLogSystem();
(*callback)(AdblockPlus::LogSystem::LOG_LEVEL_TRACE, traceback.str(), "");
- return v8::Undefined();
}
}
« no previous file with comments | « shell/src/Main.cpp ('k') | src/FileSystemJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld