Remove unused methods of IDWeakMap

This commit is contained in:
Cheng Zhao 2016-05-11 12:24:02 +09:00
parent 2cd41b2f84
commit 7f2a46cdd5
4 changed files with 1 additions and 25 deletions

View file

@ -36,10 +36,6 @@ void IDWeakMap::Remove(int32_t id) {
id_weak_map_.Remove(id);
}
void IDWeakMap::Clear() {
id_weak_map_.Clear();
}
// static
void IDWeakMap::BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype) {
@ -47,8 +43,7 @@ void IDWeakMap::BuildPrototype(v8::Isolate* isolate,
.SetMethod("set", &IDWeakMap::Set)
.SetMethod("get", &IDWeakMap::Get)
.SetMethod("has", &IDWeakMap::Has)
.SetMethod("remove", &IDWeakMap::Remove)
.SetMethod("clear", &IDWeakMap::Clear);
.SetMethod("remove", &IDWeakMap::Remove);
}
// static

View file

@ -30,7 +30,6 @@ class IDWeakMap : public mate::Wrappable<IDWeakMap> {
v8::Local<v8::Object> Get(v8::Isolate* isolate, int32_t id);
bool Has(int32_t id);
void Remove(int32_t id);
void Clear();
atom::IDWeakMap id_weak_map_;

View file

@ -59,14 +59,6 @@ bool IDWeakMap::Has(int32_t id) const {
return map_.find(id) != map_.end();
}
std::vector<int32_t> IDWeakMap::Keys() const {
std::vector<int32_t> keys;
keys.reserve(map_.size());
for (const auto& iter : map_)
keys.emplace_back(iter.first);
return keys;
}
std::vector<v8::Local<v8::Object>> IDWeakMap::Values(v8::Isolate* isolate) {
std::vector<v8::Local<v8::Object>> keys;
keys.reserve(map_.size());
@ -83,10 +75,6 @@ void IDWeakMap::Remove(int32_t id) {
map_.erase(iter);
}
void IDWeakMap::Clear() {
map_.clear();
}
int32_t IDWeakMap::GetNextID() {
return ++next_id_;
}

View file

@ -31,18 +31,12 @@ class IDWeakMap {
// Whethere there is an object with |id| in this WeakMap.
bool Has(int32_t id) const;
// Returns IDs of all available objects.
std::vector<int32_t> Keys() const;
// Returns all objects.
std::vector<v8::Local<v8::Object>> Values(v8::Isolate* isolate);
// Remove object with |id| in the WeakMap.
void Remove(int32_t key);
// Clears the weak map.
void Clear();
private:
// Returns next available ID.
int32_t GetNextID();