Move createIDWeakMap to v8Util

This commit is contained in:
Cheng Zhao 2016-05-11 19:30:06 +09:00
parent a077355d70
commit 49ac160ff7
6 changed files with 4 additions and 27 deletions

View file

@ -1,21 +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.
#include "atom/common/api/atom_api_key_weak_map.h"
#include "atom/common/node_includes.h"
#include "native_mate/dictionary.h"
namespace {
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("createIDWeakMap",
&atom::api::KeyWeakMap<int32_t>::Create);
}
} // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_id_weak_map, Initialize)

View file

@ -4,6 +4,7 @@
#include <string>
#include "atom/common/api/atom_api_key_weak_map.h"
#include "atom/common/api/remote_callback_freer.h"
#include "atom/common/api/remote_object_freer.h"
#include "atom/common/native_mate_converters/content_converter.h"
@ -67,6 +68,7 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
dict.SetMethod("takeHeapSnapshot", &TakeHeapSnapshot);
dict.SetMethod("setRemoteCallbackFreer", &atom::RemoteCallbackFreer::BindTo);
dict.SetMethod("setRemoteObjectFreer", &atom::RemoteObjectFreer::BindTo);
dict.SetMethod("createIDWeakMap", &atom::api::KeyWeakMap<int32_t>::Create);
}
} // namespace

View file

@ -52,7 +52,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);

View file

@ -288,7 +288,6 @@
'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_key_weak_map.cc',
'atom/common/api/atom_api_key_weak_map.h',
'atom/common/api/atom_api_native_image.cc',
'atom/common/api/atom_api_native_image.h',

View file

@ -3,7 +3,6 @@
const electron = require('electron')
const v8Util = process.atomBinding('v8_util')
const {ipcMain} = electron
const {createIDWeakMap} = process.atomBinding('id_weak_map')
const objectsRegistry = require('./objects-registry')
@ -14,7 +13,7 @@ const FUNCTION_PROPERTIES = [
// The remote functions in renderer processes.
// id => Function
let rendererFunctions = createIDWeakMap()
let rendererFunctions = v8Util.createIDWeakMap()
// Merge two IDs together.
let mergeIds = function (webContentsId, metaId) {

View file

@ -2,13 +2,12 @@
const v8Util = process.atomBinding('v8_util')
const {ipcRenderer, CallbacksRegistry} = require('electron')
const {createIDWeakMap} = process.atomBinding('id_weak_map')
const callbacksRegistry = new CallbacksRegistry()
var includes = [].includes
var remoteObjectCache = createIDWeakMap()
var remoteObjectCache = v8Util.createIDWeakMap()
// Check for circular reference.
var isCircular = function (field, visited) {