4
4
5
5
using namespace v8 ;
6
6
using namespace std ;
7
- namespace tns {
8
-
9
- Local <v8::Function>
10
- GetDebuggerFunction (Local <Context> context, std::string domain, std::string functionName,
11
- Local <Object> &domainDebugger) {
12
- auto it = JsV8InspectorClient::Domains.find (domain);
13
- if (it == JsV8InspectorClient::Domains.end ()) {
14
- return Local<v8::Function>();
15
- }
16
-
17
- Isolate *isolate = context->GetIsolate ();
18
- domainDebugger = it->second ->Get (isolate);
19
-
20
- Local <Value> value;
21
- auto funcName = v8::String::NewFromUtf8 (isolate, functionName.c_str (),
22
- v8::NewStringType::kNormal ,
23
- (int ) functionName.length ()).ToLocalChecked ();
24
- bool success = domainDebugger->Get (context, funcName).ToLocal (&value);
25
- if (success && !value.IsEmpty () && value->IsFunction ()) {
26
- return value.As <v8::Function>();
27
- }
28
7
8
+
9
+ Local<v8::Function>
10
+ tns::inspector::GetDebuggerFunction (Local<Context> context, std::string domain,
11
+ std::string functionName,
12
+ Local<Object> &domainDebugger) {
13
+ auto it = JsV8InspectorClient::Domains.find (domain);
14
+ if (it == JsV8InspectorClient::Domains.end ()) {
29
15
return Local<v8::Function>();
30
16
}
31
17
32
- Local <v8::Function>
33
- GetDebuggerFunctionFromObject (Local <Context> context, const Local <Object> &object,
34
- Local <Object> &domainDebugger) {
35
- Isolate *isolate = context->GetIsolate ();
36
- auto methodKey = v8::String::NewFromUtf8 (isolate, " method" ,
37
- v8::NewStringType::kNormal ).ToLocalChecked ();
38
- auto method = object->Get (context, methodKey).ToLocalChecked ();
39
- auto methodString = Util::ToString (isolate, method);
40
- auto domainSeparatorIndex = methodString.find (" ." );
41
- auto domain = methodString.substr (0 , domainSeparatorIndex);
42
- auto domainMethod = methodString.substr (domainSeparatorIndex + 1 , methodString.size ());
43
-
44
- if (domain.size () > 0 ) {
45
- return GetDebuggerFunction (context, domain, domainMethod, domainDebugger);
46
- }
18
+ Isolate *isolate = context->GetIsolate ();
19
+ domainDebugger = it->second ->Get (isolate);
47
20
48
- return Local<v8::Function>();
21
+ Local<Value> value;
22
+ auto funcName = v8::String::NewFromUtf8 (isolate, functionName.c_str (),
23
+ v8::NewStringType::kNormal ,
24
+ (int ) functionName.length ()).ToLocalChecked ();
25
+ bool success = domainDebugger->Get (context, funcName).ToLocal (&value);
26
+ if (success && !value.IsEmpty () && value->IsFunction ()) {
27
+ return value.As <v8::Function>();
49
28
}
29
+
30
+ return Local<v8::Function>();
31
+ }
32
+
33
+ Local<v8::Function>
34
+ tns::inspector::GetDebuggerFunctionFromObject (Local<Context> context, const Local<Object> &object,
35
+ Local<Object> &domainDebugger) {
36
+ Isolate *isolate = context->GetIsolate ();
37
+ auto methodKey = v8::String::NewFromUtf8 (isolate, " method" ,
38
+ v8::NewStringType::kNormal ).ToLocalChecked ();
39
+ auto method = object->Get (context, methodKey).ToLocalChecked ();
40
+ auto methodString = Util::ToString (isolate, method);
41
+ auto domainSeparatorIndex = methodString.find (" ." );
42
+ auto domain = methodString.substr (0 , domainSeparatorIndex);
43
+ auto domainMethod = methodString.substr (domainSeparatorIndex + 1 , methodString.size ());
44
+
45
+ if (domain.size () > 0 ) {
46
+ return GetDebuggerFunction (context, domain, domainMethod, domainDebugger);
47
+ }
48
+
49
+ return Local<v8::Function>();
50
50
}
0 commit comments