11
11
#include " atom/common/chrome_version.h"
12
12
#include " atom/common/native_mate_converters/string16_converter.h"
13
13
#include " base/logging.h"
14
- #include " native_mate/callback .h"
14
+ #include " base/debug/debugger .h"
15
15
#include " native_mate/dictionary.h"
16
16
17
17
#include " atom/common/node_includes.h"
@@ -20,22 +20,8 @@ namespace atom {
20
20
21
21
namespace {
22
22
23
- // Async handle to execute the stored v8 callback.
24
- uv_async_t g_callback_uv_handle;
25
-
26
- // Stored v8 callback, to be called by the async handler.
27
- base::Closure g_v8_callback;
28
-
29
- // Dummy class type that used for crashing the program.
30
- struct DummyClass { bool crash; };
31
-
32
- // Async handler to execute the stored v8 callback.
33
- void UvOnCallback (uv_async_t * handle) {
34
- g_v8_callback.Run ();
35
- }
36
-
37
23
void Crash () {
38
- static_cast <DummyClass*>( NULL )-> crash = true ;
24
+ base::debug::BreakDebugger () ;
39
25
}
40
26
41
27
// Called when there is a fatal error in V8, we just crash the process here so
@@ -49,19 +35,12 @@ void Log(const base::string16& message) {
49
35
logging::LogMessage (" CONSOLE" , 0 , 0 ).stream () << message;
50
36
}
51
37
52
- void ScheduleCallback (const base::Closure& callback) {
53
- g_v8_callback = callback;
54
- uv_async_send (&g_callback_uv_handle);
55
- }
56
-
57
38
} // namespace
58
39
59
40
60
41
AtomBindings::AtomBindings () {
61
42
uv_async_init (uv_default_loop (), &call_next_tick_async_, OnCallNextTick);
62
43
call_next_tick_async_.data = this ;
63
-
64
- uv_async_init (uv_default_loop (), &g_callback_uv_handle, UvOnCallback);
65
44
}
66
45
67
46
AtomBindings::~AtomBindings () {
@@ -74,16 +53,13 @@ void AtomBindings::BindTo(v8::Isolate* isolate,
74
53
mate::Dictionary dict (isolate, process);
75
54
dict.SetMethod (" crash" , &Crash);
76
55
dict.SetMethod (" log" , &Log);
77
- dict.SetMethod (" scheduleCallback" , &ScheduleCallback);
78
56
dict.SetMethod (" activateUvLoop" ,
79
57
base::Bind (&AtomBindings::ActivateUVLoop, base::Unretained (this )));
80
58
81
- v8::Handle<v8::Object> versions;
59
+ mate::Dictionary versions;
82
60
if (dict.Get (" versions" , &versions)) {
83
- versions->Set (mate::StringToV8 (isolate, " atom-shell" ),
84
- mate::StringToV8 (isolate, ATOM_VERSION_STRING));
85
- versions->Set (mate::StringToV8 (isolate, " chrome" ),
86
- mate::StringToV8 (isolate, CHROME_VERSION_STRING));
61
+ versions.Set (" atom-shell" , ATOM_VERSION_STRING);
62
+ versions.Set (" chrome" , CHROME_VERSION_STRING);
87
63
}
88
64
}
89
65
0 commit comments