]> khamidou — GitHub mirrors - electron.git/commitdiff
IDWeakMap is not used anly more in JS
authorCheng Zhao <zcbenz@gmail.com>
Thu, 27 Aug 2015 11:48:55 +0000 (19:48 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 27 Aug 2015 11:55:16 +0000 (19:55 +0800)
atom/common/api/atom_api_id_weak_map.cc [deleted file]
atom/common/api/atom_api_id_weak_map.h [deleted file]
atom/common/node_bindings.cc
filenames.gypi

diff --git a/atom/common/api/atom_api_id_weak_map.cc b/atom/common/api/atom_api_id_weak_map.cc
deleted file mode 100644 (file)
index c5fbf09..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2013 GitHub, Inc.
-// Use of this source code is governed by the MIT license that can be
-// found in the LICENSE file.
-
-#include "atom/common/api/atom_api_id_weak_map.h"
-
-#include "native_mate/constructor.h"
-#include "native_mate/object_template_builder.h"
-
-#include "atom/common/node_includes.h"
-
-namespace atom {
-
-namespace api {
-
-IDWeakMap::IDWeakMap() {
-}
-
-IDWeakMap::~IDWeakMap() {
-}
-
-int32_t IDWeakMap::Add(v8::Isolate* isolate, v8::Local<v8::Object> object) {
-  return map_.Add(isolate, object);
-}
-
-v8::Local<v8::Value> IDWeakMap::Get(v8::Isolate* isolate, int32_t key) {
-  v8::MaybeLocal<v8::Object> result = map_.Get(isolate, key);
-  if (result.IsEmpty()) {
-    isolate->ThrowException(v8::Exception::Error(
-        mate::StringToV8(isolate, "Invalid key")));
-    return v8::Undefined(isolate);
-  } else {
-    return result.ToLocalChecked();
-  }
-}
-
-bool IDWeakMap::Has(int32_t key) const {
-  return map_.Has(key);
-}
-
-std::vector<int32_t> IDWeakMap::Keys() const {
-  return map_.Keys();
-}
-
-void IDWeakMap::Remove(int32_t key) {
-  map_.Remove(key);
-}
-
-// static
-void IDWeakMap::BuildPrototype(v8::Isolate* isolate,
-                               v8::Local<v8::ObjectTemplate> prototype) {
-  mate::ObjectTemplateBuilder(isolate, prototype)
-      .SetMethod("add", &IDWeakMap::Add)
-      .SetMethod("get", &IDWeakMap::Get)
-      .SetMethod("has", &IDWeakMap::Has)
-      .SetMethod("keys", &IDWeakMap::Keys)
-      .SetMethod("remove", &IDWeakMap::Remove);
-}
-
-}  // namespace api
-
-}  // namespace atom
-
-
-namespace {
-
-void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
-                v8::Local<v8::Context> context, void* priv) {
-  using atom::api::IDWeakMap;
-  v8::Isolate* isolate = context->GetIsolate();
-  v8::Local<v8::Function> constructor = mate::CreateConstructor<IDWeakMap>(
-      isolate,
-      "IDWeakMap",
-      base::Bind(&mate::NewOperatorFactory<IDWeakMap>));
-  exports->Set(mate::StringToSymbol(isolate, "IDWeakMap"), constructor);
-}
-
-}  // namespace
-
-NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_id_weak_map, Initialize)
diff --git a/atom/common/api/atom_api_id_weak_map.h b/atom/common/api/atom_api_id_weak_map.h
deleted file mode 100644 (file)
index 955bd83..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2013 GitHub, Inc.
-// Copyright (c) 2012 Intel Corp. All rights reserved.
-// Use of this source code is governed by the MIT license that can be
-// found in the LICENSE file.
-
-#ifndef ATOM_COMMON_API_ATOM_API_ID_WEAK_MAP_H_
-#define ATOM_COMMON_API_ATOM_API_ID_WEAK_MAP_H_
-
-#include <vector>
-
-#include "atom/common/id_weak_map.h"
-#include "native_mate/wrappable.h"
-
-namespace atom {
-
-namespace api {
-
-// Like ES6's WeakMap, but the key is Integer and the value is Weak Pointer.
-class IDWeakMap : public mate::Wrappable {
- public:
-  IDWeakMap();
-
-  static void BuildPrototype(v8::Isolate* isolate,
-                             v8::Local<v8::ObjectTemplate> prototype);
-
- private:
-  virtual ~IDWeakMap();
-
-  int32_t Add(v8::Isolate* isolate, v8::Local<v8::Object> object);
-  v8::Local<v8::Value> Get(v8::Isolate* isolate, int32_t key);
-  bool Has(int32_t key) const;
-  std::vector<int32_t> Keys() const;
-  void Remove(int32_t key);
-
-  atom::IDWeakMap map_;
-
-  DISALLOW_COPY_AND_ASSIGN(IDWeakMap);
-};
-
-}  // namespace api
-
-}  // namespace atom
-
-#endif  // ATOM_COMMON_API_ATOM_API_ID_WEAK_MAP_H_
index 8c03f1459967103305925d86a5086483c97ae367..5aed5619f9cf035511af31bbf122c7195057c1bb 100644 (file)
@@ -47,7 +47,6 @@ REFERENCE_MODULE(atom_browser_window);
 REFERENCE_MODULE(atom_common_asar);
 REFERENCE_MODULE(atom_common_clipboard);
 REFERENCE_MODULE(atom_common_crash_reporter);
-REFERENCE_MODULE(atom_common_id_weak_map);
 REFERENCE_MODULE(atom_common_native_image);
 REFERENCE_MODULE(atom_common_screen);
 REFERENCE_MODULE(atom_common_shell);
index feb35789afe195016e9b10fb3dbfc883cf13a31c..af0c56e1ea695e04679fbae16f6733895cddc333 100644 (file)
       'atom/common/api/atom_api_asar.cc',
       'atom/common/api/atom_api_clipboard.cc',
       'atom/common/api/atom_api_crash_reporter.cc',
-      'atom/common/api/atom_api_id_weak_map.cc',
-      'atom/common/api/atom_api_id_weak_map.h',
       'atom/common/api/atom_api_native_image.cc',
       'atom/common/api/atom_api_native_image.h',
       'atom/common/api/atom_api_native_image_mac.mm',