chore: remove native_mate (Part 2) (#20106)

* add notice to files being removed

* add gin version of function_template.h

* rename callback.h to avoid confliction

* add gin version of callback_converter

* add gin converter for OnceCallback

* remove callback_converter_gin_adapter.h

* remove gin_util.h and gin_utils.h

* fix lint warning

* add helper for setting methods
This commit is contained in:
Cheng Zhao 2019-09-05 00:45:25 +09:00 committed by Robo
parent 504cdb13f0
commit 81ae154714
42 changed files with 866 additions and 202 deletions

View file

@ -7,9 +7,9 @@
#include "base/bind.h"
#include "gin/data_object_builder.h"
#include "gin/dictionary.h"
#include "shell/common/crash_reporter/crash_reporter.h"
#include "shell/common/gin_util.h"
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/native_mate_converters/file_path_converter.h"
#include "shell/common/native_mate_converters/map_converter.h"
@ -41,23 +41,26 @@ void Initialize(v8::Local<v8::Object> exports,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context,
void* priv) {
using gin_util::SetMethod;
auto reporter = base::Unretained(CrashReporter::GetInstance());
SetMethod(exports, "start",
base::BindRepeating(&CrashReporter::Start, reporter));
SetMethod(exports, "addExtraParameter",
base::BindRepeating(&CrashReporter::AddExtraParameter, reporter));
SetMethod(
exports, "removeExtraParameter",
gin_helper::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("start", base::BindRepeating(&CrashReporter::Start, reporter));
dict.SetMethod(
"addExtraParameter",
base::BindRepeating(&CrashReporter::AddExtraParameter, reporter));
dict.SetMethod(
"removeExtraParameter",
base::BindRepeating(&CrashReporter::RemoveExtraParameter, reporter));
SetMethod(exports, "getParameters",
base::BindRepeating(&CrashReporter::GetParameters, reporter));
SetMethod(exports, "getUploadedReports",
base::BindRepeating(&CrashReporter::GetUploadedReports, reporter));
SetMethod(exports, "setUploadToServer",
base::BindRepeating(&CrashReporter::SetUploadToServer, reporter));
SetMethod(exports, "getUploadToServer",
base::BindRepeating(&CrashReporter::GetUploadToServer, reporter));
dict.SetMethod("getParameters",
base::BindRepeating(&CrashReporter::GetParameters, reporter));
dict.SetMethod(
"getUploadedReports",
base::BindRepeating(&CrashReporter::GetUploadedReports, reporter));
dict.SetMethod(
"setUploadToServer",
base::BindRepeating(&CrashReporter::SetUploadToServer, reporter));
dict.SetMethod(
"getUploadToServer",
base::BindRepeating(&CrashReporter::GetUploadToServer, reporter));
}
} // namespace