// Copyright (c) 2013 GitHub, Inc. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include #include #include "atom/common/crash_reporter/crash_reporter.h" #include "base/bind.h" #include "native_mate/dictionary.h" #include "atom/common/node_includes.h" namespace mate { template<> struct Converter > { static bool FromV8(v8::Isolate* isolate, v8::Handle val, std::map* out) { if (!val->IsObject()) return false; v8::Handle dict = val->ToObject(); v8::Handle keys = dict->GetOwnPropertyNames(); for (uint32_t i = 0; i < keys->Length(); ++i) { v8::Handle key = keys->Get(i); (*out)[V8ToString(key)] = V8ToString(dict->Get(key)); } return true; } }; } // namespace mate namespace { void Initialize(v8::Handle exports) { using crash_reporter::CrashReporter; mate::Dictionary dict(v8::Isolate::GetCurrent(), exports); dict.SetMethod("start", base::Bind(&CrashReporter::Start, base::Unretained(CrashReporter::GetInstance()))); } } // namespace NODE_MODULE(atom_common_crash_reporter, Initialize)