diff --git a/filenames.gni b/filenames.gni index fda2e221cf5b..3d330fbb0ac7 100644 --- a/filenames.gni +++ b/filenames.gni @@ -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", diff --git a/shell/common/api/electron_api_key_weak_map.h b/shell/common/api/electron_api_key_weak_map.h deleted file mode 100644 index 2b9d1e92d588..000000000000 --- a/shell/common/api/electron_api_key_weak_map.h +++ /dev/null @@ -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 -class KeyWeakMap : public gin_helper::Wrappable> { - public: - static gin::Handle> Create(v8::Isolate* isolate) { - return gin::CreateHandle(isolate, new KeyWeakMap(isolate)); - } - - static void BuildPrototype(v8::Isolate* isolate, - v8::Local prototype) { - prototype->SetClassName(gin::StringToV8(isolate, "KeyWeakMap")); - gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate()) - .SetMethod("set", &KeyWeakMap::Set) - .SetMethod("get", &KeyWeakMap::Get) - .SetMethod("has", &KeyWeakMap::Has) - .SetMethod("remove", &KeyWeakMap::Remove); - } - - // disable copy - KeyWeakMap(const KeyWeakMap&) = delete; - KeyWeakMap& operator=(const KeyWeakMap&) = delete; - - protected: - explicit KeyWeakMap(v8::Isolate* isolate) { - gin_helper::Wrappable>::Init(isolate); - } - ~KeyWeakMap() override {} - - private: - // API for KeyWeakMap. - void Set(v8::Isolate* isolate, const K& key, v8::Local object) { - key_weak_map_.Set(isolate, key, object); - } - - v8::Local 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 key_weak_map_; -}; - -} // namespace electron::api - -#endif // ELECTRON_SHELL_COMMON_API_ELECTRON_API_KEY_WEAK_MAP_H_ diff --git a/shell/common/api/electron_api_v8_util.cc b/shell/common/api/electron_api_v8_util.cc index 7291024b2522..ff5a158f94ac 100644 --- a/shell/common/api/electron_api_v8_util.cc +++ b/shell/common/api/electron_api_v8_util.cc @@ -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"