chore: remove unused KeyWeakMap JS bindings (#43144)

The last three pieces of code that used it were removed in:

- Oct 2020 (8df4faa8 #25711)
- Jun 2020 (e1e73fa5 #24115)
- Jun 2020 (c0182bca #24116).

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2024-07-31 18:56:54 -05:00 committed by GitHub
parent ce426cd957
commit dbcd56209a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 0 additions and 64 deletions

View file

@ -548,7 +548,6 @@ filenames = {
"shell/common/api/electron_api_clipboard.h",
"shell/common/api/electron_api_command_line.cc",
"shell/common/api/electron_api_environment.cc",
"shell/common/api/electron_api_key_weak_map.h",
"shell/common/api/electron_api_native_image.cc",
"shell/common/api/electron_api_native_image.h",
"shell/common/api/electron_api_net.cc",

View file

@ -1,62 +0,0 @@
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_COMMON_API_ELECTRON_API_KEY_WEAK_MAP_H_
#define ELECTRON_SHELL_COMMON_API_ELECTRON_API_KEY_WEAK_MAP_H_
#include "gin/handle.h"
#include "shell/common/gin_converters/std_converter.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/gin_helper/wrappable.h"
#include "shell/common/key_weak_map.h"
namespace electron::api {
template <typename K>
class KeyWeakMap : public gin_helper::Wrappable<KeyWeakMap<K>> {
public:
static gin::Handle<KeyWeakMap<K>> Create(v8::Isolate* isolate) {
return gin::CreateHandle(isolate, new KeyWeakMap<K>(isolate));
}
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype) {
prototype->SetClassName(gin::StringToV8(isolate, "KeyWeakMap"));
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
.SetMethod("set", &KeyWeakMap<K>::Set)
.SetMethod("get", &KeyWeakMap<K>::Get)
.SetMethod("has", &KeyWeakMap<K>::Has)
.SetMethod("remove", &KeyWeakMap<K>::Remove);
}
// disable copy
KeyWeakMap(const KeyWeakMap&) = delete;
KeyWeakMap& operator=(const KeyWeakMap&) = delete;
protected:
explicit KeyWeakMap(v8::Isolate* isolate) {
gin_helper::Wrappable<KeyWeakMap<K>>::Init(isolate);
}
~KeyWeakMap() override {}
private:
// API for KeyWeakMap.
void Set(v8::Isolate* isolate, const K& key, v8::Local<v8::Object> object) {
key_weak_map_.Set(isolate, key, object);
}
v8::Local<v8::Object> Get(v8::Isolate* isolate, const K& key) {
return key_weak_map_.Get(isolate, key).ToLocalChecked();
}
bool Has(const K& key) { return key_weak_map_.Has(key); }
void Remove(const K& key) { key_weak_map_.Remove(key); }
electron::KeyWeakMap<K> key_weak_map_;
};
} // namespace electron::api
#endif // ELECTRON_SHELL_COMMON_API_ELECTRON_API_KEY_WEAK_MAP_H_

View file

@ -7,7 +7,6 @@
#include "base/run_loop.h"
#include "electron/buildflags/buildflags.h"
#include "shell/common/api/electron_api_key_weak_map.h"
#include "shell/common/gin_converters/content_converter.h"
#include "shell/common/gin_converters/gurl_converter.h"
#include "shell/common/gin_converters/std_converter.h"