int V8Proxy::contextDebugId(v8::Handle<v8::Context> context) { v8::HandleScope scope; if (!context->GetData()->IsObject()) return -1; v8::Handle<v8::Value> data = context->GetData()->ToObject()->Get( v8::String::New(kContextDebugDataValue)); return data->IsInt32() ? data->Int32Value() : -1; }
int V8Proxy::contextDebugId(v8::Handle<v8::Context> context) { v8::HandleScope scope; if (!context->GetData()->IsString()) return -1; v8::String::AsciiValue ascii(context->GetData()); char* comma = strnstr(*ascii, ",", ascii.length()); if (!comma) return -1; return atoi(comma + 1); }