#include "atom/common/chrome_version.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "base/logging.h"
-#include "native_mate/callback.h"
+#include "base/debug/debugger.h"
#include "native_mate/dictionary.h"
#include "atom/common/node_includes.h"
namespace {
-// Async handle to execute the stored v8 callback.
-uv_async_t g_callback_uv_handle;
-
-// Stored v8 callback, to be called by the async handler.
-base::Closure g_v8_callback;
-
-// Dummy class type that used for crashing the program.
-struct DummyClass { bool crash; };
-
-// Async handler to execute the stored v8 callback.
-void UvOnCallback(uv_async_t* handle) {
- g_v8_callback.Run();
-}
-
void Crash() {
- static_cast<DummyClass*>(NULL)->crash = true;
+ base::debug::BreakDebugger();
}
// Called when there is a fatal error in V8, we just crash the process here so
logging::LogMessage("CONSOLE", 0, 0).stream() << message;
}
-void ScheduleCallback(const base::Closure& callback) {
- g_v8_callback = callback;
- uv_async_send(&g_callback_uv_handle);
-}
-
} // namespace
AtomBindings::AtomBindings() {
uv_async_init(uv_default_loop(), &call_next_tick_async_, OnCallNextTick);
call_next_tick_async_.data = this;
-
- uv_async_init(uv_default_loop(), &g_callback_uv_handle, UvOnCallback);
}
AtomBindings::~AtomBindings() {
mate::Dictionary dict(isolate, process);
dict.SetMethod("crash", &Crash);
dict.SetMethod("log", &Log);
- dict.SetMethod("scheduleCallback", &ScheduleCallback);
dict.SetMethod("activateUvLoop",
base::Bind(&AtomBindings::ActivateUVLoop, base::Unretained(this)));
- v8::Handle<v8::Object> versions;
+ mate::Dictionary versions;
if (dict.Get("versions", &versions)) {
- versions->Set(mate::StringToV8(isolate, "atom-shell"),
- mate::StringToV8(isolate, ATOM_VERSION_STRING));
- versions->Set(mate::StringToV8(isolate, "chrome"),
- mate::StringToV8(isolate, CHROME_VERSION_STRING));
+ versions.Set("atom-shell", ATOM_VERSION_STRING);
+ versions.Set("chrome", CHROME_VERSION_STRING);
}
}