Use // for single line comments

This commit is contained in:
Kevin Sawicki 2016-01-14 10:35:29 -08:00
parent 26350f4ccb
commit f4af744519
43 changed files with 311 additions and 310 deletions

View file

@ -9,7 +9,7 @@ path = require('path');
url = require('url');
/* Mapping between hostname and file path. */
// Mapping between hostname and file path.
hostPathMap = {};
@ -27,7 +27,7 @@ getPathForHost = function(host) {
};
/* Cache extensionInfo. */
// Cache extensionInfo.
extensionInfoMap = {};
@ -57,14 +57,14 @@ getExtensionInfoFromPath = function(srcDirectory) {
};
/* The loaded extensions cache and its persistent path. */
// The loaded extensions cache and its persistent path.
loadedExtensions = null;
loadedExtensionsPath = null;
/* Persistent loaded extensions. */
// Persistent loaded extensions.
app = electron.app;
@ -86,13 +86,13 @@ app.on('will-quit', function() {
});
/* We can not use protocol or BrowserWindow until app is ready. */
// We can not use protocol or BrowserWindow until app is ready.
app.once('ready', function() {
var BrowserWindow, chromeExtensionHandler, e, error1, i, init, len, protocol, srcDirectory;
protocol = electron.protocol, BrowserWindow = electron.BrowserWindow;
/* Load persistented extensions. */
// Load persistented extensions.
loadedExtensionsPath = path.join(app.getPath('userData'), 'DevTools Extensions');
try {
loadedExtensions = JSON.parse(fs.readFileSync(loadedExtensionsPath));
@ -100,7 +100,7 @@ app.once('ready', function() {
loadedExtensions = [];
}
/* Preheat the extensionInfo cache. */
// Preheat the extensionInfo cache.
for (i = 0, len = loadedExtensions.length; i < len; i++) {
srcDirectory = loadedExtensions[i];
getExtensionInfoFromPath(srcDirectory);
@ -109,7 +109,7 @@ app.once('ready', function() {
e = error1;
}
/* The chrome-extension: can map a extension URL request to real file path. */
// The chrome-extension: can map a extension URL request to real file path.
chromeExtensionHandler = function(request, callback) {
var directory, parsed;
parsed = url.parse(request.url);
@ -150,7 +150,7 @@ app.once('ready', function() {
return delete extensionInfoMap[name];
};
/* Load persistented extensions when devtools is opened. */
// Load persistented extensions when devtools is opened.
init = BrowserWindow.prototype._init;
return BrowserWindow.prototype._init = function() {
init.call(this);

View file

@ -9,7 +9,7 @@ deepEqual = function(opt1, opt2) {
};
/* A queue for holding all requests from renderer process. */
// A queue for holding all requests from renderer process.
requestsQueue = [];
@ -40,7 +40,7 @@ ipcMain.on('ATOM_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', function(event, captureW
desktopCapturer.emit = function(event, name, sources) {
/* Receiving sources result from main process, now send them back to renderer. */
// Receiving sources result from main process, now send them back to renderer.
var captureScreen, captureWindow, handledRequest, i, len, ref, ref1, ref2, request, result, source, thumbnailSize, unhandledRequestsQueue;
handledRequest = requestsQueue.shift(0);
result = (function() {
@ -77,7 +77,7 @@ desktopCapturer.emit = function(event, name, sources) {
}
requestsQueue = unhandledRequestsQueue;
/* If the requestsQueue is not empty, start a new request handling. */
// If the requestsQueue is not empty, start a new request handling.
if (requestsQueue.length > 0) {
ref2 = requestsQueue[0].options, captureWindow = ref2.captureWindow, captureScreen = ref2.captureScreen, thumbnailSize = ref2.thumbnailSize;
return desktopCapturer.startHandling(captureWindow, captureScreen, thumbnailSize);

View file

@ -4,7 +4,7 @@ var attachGuest, createGuest, destroyGuest, embedderElementsMap, getNextInstance
ref = require('electron'), ipcMain = ref.ipcMain, webContents = ref.webContents;
/* Doesn't exist in early initialization. */
// Doesn't exist in early initialization.
webViewManager = null;
@ -19,21 +19,21 @@ embedderElementsMap = {};
reverseEmbedderElementsMap = {};
/* Moves the last element of array to the first one. */
// Moves the last element of array to the first one.
moveLastToFirst = function(list) {
return list.unshift(list.pop());
};
/* Generate guestInstanceId. */
// Generate guestInstanceId.
getNextInstanceId = function(webContents) {
return ++nextInstanceId;
};
/* Create a new guest instance. */
// Create a new guest instance.
createGuest = function(embedder, params) {
var destroy, destroyEvents, event, fn, guest, i, id, j, len, len1, listeners;
@ -51,7 +51,7 @@ createGuest = function(embedder, params) {
embedder: embedder
};
/* Destroy guest when the embedder is gone or navigated. */
// Destroy guest when the embedder is gone or navigated.
destroyEvents = ['will-destroy', 'crashed', 'did-navigate'];
destroy = function() {
if (guestInstances[id] != null) {
@ -82,7 +82,7 @@ createGuest = function(embedder, params) {
return results;
});
/* Init guest web view after attached. */
// Init guest web view after attached.
guest.once('did-attach', function() {
var opts;
params = this.attachParams;
@ -119,7 +119,7 @@ createGuest = function(embedder, params) {
return guest.allowPopups = params.allowpopups;
});
/* Dispatch events to embedder. */
// Dispatch events to embedder.
fn = function(event) {
return guest.on(event, function() {
var _, args;
@ -132,14 +132,14 @@ createGuest = function(embedder, params) {
fn(event);
}
/* Dispatch guest's IPC messages to embedder. */
// Dispatch guest's IPC messages to embedder.
guest.on('ipc-message-host', function(_, packed) {
var args, channel;
channel = packed[0], args = 2 <= packed.length ? slice.call(packed, 1) : [];
return embedder.send.apply(embedder, ["ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-" + guest.viewInstanceId, channel].concat(slice.call(args)));
});
/* Autosize. */
// Autosize.
guest.on('size-changed', function() {
var _, args;
_ = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
@ -149,18 +149,18 @@ createGuest = function(embedder, params) {
};
/* Attach the guest to an element of embedder. */
// Attach the guest to an element of embedder.
attachGuest = function(embedder, elementInstanceId, guestInstanceId, params) {
var guest, key, oldGuestInstanceId, ref1, webPreferences;
guest = guestInstances[guestInstanceId].guest;
/* Destroy the old guest when attaching. */
// Destroy the old guest when attaching.
key = (embedder.getId()) + "-" + elementInstanceId;
oldGuestInstanceId = embedderElementsMap[key];
if (oldGuestInstanceId != null) {
/* Reattachment to the same guest is not currently supported. */
// Reattachment to the same guest is not currently supported.
if (oldGuestInstanceId === guestInstanceId) {
return;
}
@ -185,7 +185,7 @@ attachGuest = function(embedder, elementInstanceId, guestInstanceId, params) {
};
/* Destroy an existing guest instance. */
// Destroy an existing guest instance.
destroyGuest = function(embedder, id) {
var key;
@ -222,7 +222,7 @@ ipcMain.on('ATOM_SHELL_GUEST_VIEW_MANAGER_SET_ALLOW_TRANSPARENCY', function(even
});
/* Returns WebContents from its guest id. */
// Returns WebContents from its guest id.
exports.getGuest = function(id) {
var ref1;
@ -230,7 +230,7 @@ exports.getGuest = function(id) {
};
/* Returns the embedder of the guest. */
// Returns the embedder of the guest.
exports.getEmbedder = function(id) {
var ref1;

View file

@ -9,7 +9,7 @@ v8Util = process.atomBinding('v8_util');
frameToGuest = {};
/* Copy attribute of |parent| to |child| if it is not defined in |child|. */
// Copy attribute of |parent| to |child| if it is not defined in |child|.
mergeOptions = function(child, parent) {
var key, value;
@ -28,16 +28,16 @@ mergeOptions = function(child, parent) {
};
/* Merge |options| with the |embedder|'s window's options. */
// Merge |options| with the |embedder|'s window's options.
mergeBrowserWindowOptions = function(embedder, options) {
if (embedder.browserWindowOptions != null) {
/* Inherit the original options if it is a BrowserWindow. */
// Inherit the original options if it is a BrowserWindow.
mergeOptions(options, embedder.browserWindowOptions);
} else {
/* Or only inherit web-preferences if it is a webview. */
// Or only inherit web-preferences if it is a webview.
if (options.webPreferences == null) {
options.webPreferences = {};
}
@ -47,7 +47,7 @@ mergeBrowserWindowOptions = function(embedder, options) {
};
/* Create a new guest created by |embedder| with |options|. */
// Create a new guest created by |embedder| with |options|.
createGuest = function(embedder, url, frameName, options) {
var closedByEmbedder, closedByUser, guest, guestId, ref1;
@ -57,7 +57,7 @@ createGuest = function(embedder, url, frameName, options) {
return guest.id;
}
/* Remember the embedder window's id. */
// Remember the embedder window's id.
if (options.webPreferences == null) {
options.webPreferences = {};
}
@ -92,7 +92,7 @@ createGuest = function(embedder, url, frameName, options) {
};
/* Routed window.open messages. */
// Routed window.open messages.
ipcMain.on('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', function() {
var args, event, frameName, options, url;

View file

@ -10,20 +10,20 @@ util = require('util');
Module = require('module');
/* We modified the original process.argv to let node.js load the atom.js, */
// We modified the original process.argv to let node.js load the atom.js,
/* we need to restore it here. */
// we need to restore it here.
process.argv.splice(1, 1);
/* Clear search paths. */
// Clear search paths.
require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'reset-search-paths'));
/* Import common settings. */
// Import common settings.
require(path.resolve(__dirname, '..', '..', 'common', 'lib', 'init'));
@ -34,7 +34,7 @@ if (!process.env.ELECTRON_HIDE_INTERNAL_MODULES) {
}
/* Expose public APIs. */
// Expose public APIs.
globalPaths.push(path.resolve(__dirname, '..', 'api', 'lib', 'exports'));
@ -62,7 +62,7 @@ if (process.platform === 'win32') {
console.log = console.error = console.warn = consoleLog;
process.stdout.write = process.stderr.write = streamWrite;
/* Always returns EOF for stdin stream. */
// Always returns EOF for stdin stream.
Readable = require('stream').Readable;
stdin = new Readable;
stdin.push(null);
@ -72,17 +72,17 @@ if (process.platform === 'win32') {
}
/* Don't quit on fatal error. */
// Don't quit on fatal error.
process.on('uncaughtException', function(error) {
/* Do nothing if the user has a custom uncaught exception handler. */
// Do nothing if the user has a custom uncaught exception handler.
var dialog, message, ref, stack;
if (process.listeners('uncaughtException').length > 1) {
return;
}
/* Show error in GUI. */
// Show error in GUI.
dialog = require('electron').dialog;
stack = (ref = error.stack) != null ? ref : error.name + ": " + error.message;
message = "Uncaught Exception:\n" + stack;
@ -90,7 +90,7 @@ process.on('uncaughtException', function(error) {
});
/* Emit 'exit' event on quit. */
// Emit 'exit' event on quit.
app = require('electron').app;
@ -99,24 +99,24 @@ app.on('quit', function(event, exitCode) {
});
/* Map process.exit to app.exit, which quits gracefully. */
// Map process.exit to app.exit, which quits gracefully.
process.exit = app.exit;
/* Load the RPC server. */
// Load the RPC server.
require('./rpc-server');
/* Load the guest view manager. */
// Load the guest view manager.
require('./guest-view-manager');
require('./guest-window-manager');
/* Now we try to load app's package.json. */
// Now we try to load app's package.json.
packageJson = null;
@ -142,14 +142,14 @@ if (packageJson == null) {
}
/* Set application's version. */
// Set application's version.
if (packageJson.version != null) {
app.setVersion(packageJson.version);
}
/* Set application's name. */
// Set application's name.
if (packageJson.productName != null) {
app.setName(packageJson.productName);
@ -158,7 +158,7 @@ if (packageJson.productName != null) {
}
/* Set application's desktop name. */
// Set application's desktop name.
if (packageJson.desktopName != null) {
app.setDesktopName(packageJson.desktopName);
@ -167,12 +167,12 @@ if (packageJson.desktopName != null) {
}
/* Chrome 42 disables NPAPI plugins by default, reenable them here */
// Chrome 42 disables NPAPI plugins by default, reenable them here
app.commandLine.appendSwitch('enable-npapi');
/* Set the user path according to application's name. */
// Set the user path according to application's name.
app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
@ -181,21 +181,21 @@ app.setPath('userCache', path.join(app.getPath('cache'), app.getName()));
app.setAppPath(packagePath);
/* Load the chrome extension support. */
// Load the chrome extension support.
require('./chrome-extension');
/* Load internal desktop-capturer module. */
// Load internal desktop-capturer module.
require('./desktop-capturer');
/* Set main startup script of the app. */
// Set main startup script of the app.
mainStartupScript = packageJson.main || 'index.js';
/* Finally load app's main.js and transfer control to C++. */
// Finally load app's main.js and transfer control to C++.
Module._load(path.join(packagePath, mainStartupScript), Module, true);

View file

@ -36,7 +36,7 @@ ObjectsRegistry = (function(superClass) {
var base, base1, id;
id = this.saveToStorage(obj);
/* Remember the owner. */
// Remember the owner.
if ((base = this.owners)[webContentsId] == null) {
base[webContentsId] = {};
}
@ -45,12 +45,12 @@ ObjectsRegistry = (function(superClass) {
}
this.owners[webContentsId][id]++;
/* Returns object's id */
// Returns object's id
return id;
};
/* Get an object according to its ID. */
// Get an object according to its ID.
ObjectsRegistry.prototype.get = function(id) {
var ref;
@ -58,13 +58,13 @@ ObjectsRegistry = (function(superClass) {
};
/* Dereference an object according to its ID. */
// Dereference an object according to its ID.
ObjectsRegistry.prototype.remove = function(webContentsId, id) {
var pointer;
this.dereference(id, 1);
/* Also reduce the count in owner. */
// Also reduce the count in owner.
pointer = this.owners[webContentsId];
if (pointer == null) {
return;
@ -76,7 +76,7 @@ ObjectsRegistry = (function(superClass) {
};
/* Clear all references to objects refrenced by the WebContents. */
// Clear all references to objects refrenced by the WebContents.
ObjectsRegistry.prototype.clear = function(webContentsId) {
var count, id, ref;
@ -93,7 +93,7 @@ ObjectsRegistry = (function(superClass) {
};
/* Private: Saves the object into storage and assigns an ID for it. */
// Private: Saves the object into storage and assigns an ID for it.
ObjectsRegistry.prototype.saveToStorage = function(object) {
var id;
@ -111,7 +111,7 @@ ObjectsRegistry = (function(superClass) {
};
/* Private: Dereference the object from store. */
// Private: Dereference the object from store.
ObjectsRegistry.prototype.dereference = function(id, count) {
var pointer;

View file

@ -14,7 +14,7 @@ v8Util = process.atomBinding('v8_util');
IDWeakMap = process.atomBinding('id_weak_map').IDWeakMap;
/* Convert a real value into meta data. */
// Convert a real value into meta data.
valueToMeta = function(sender, value, optimizeSimpleObject) {
var el, field, i, len, meta, name;
@ -43,12 +43,12 @@ valueToMeta = function(sender, value, optimizeSimpleObject) {
meta.type = 'promise';
}
/* Treat simple objects as value. */
// Treat simple objects as value.
if (optimizeSimpleObject && meta.type === 'object' && v8Util.getHiddenValue(value, 'simple')) {
meta.type = 'value';
}
/* Treat the arguments object as array. */
// Treat the arguments object as array.
if (meta.type === 'object' && (value.callee != null) && (value.length != null)) {
meta.type = 'array';
}
@ -86,7 +86,7 @@ valueToMeta = function(sender, value, optimizeSimpleObject) {
} else if (meta.type === 'error') {
meta.members = plainObjectToMeta(value);
/* Error.name is not part of own properties. */
// Error.name is not part of own properties.
meta.members.push({
name: 'name',
value: value.name
@ -101,7 +101,7 @@ valueToMeta = function(sender, value, optimizeSimpleObject) {
};
/* Convert object to meta by value. */
// Convert object to meta by value.
plainObjectToMeta = function(obj) {
return Object.getOwnPropertyNames(obj).map(function(name) {
@ -113,7 +113,7 @@ plainObjectToMeta = function(obj) {
};
/* Convert Error into meta data. */
// Convert Error into meta data.
exceptionToMeta = function(error) {
return {
@ -124,7 +124,7 @@ exceptionToMeta = function(error) {
};
/* Convert array of meta data from renderer into array of real values. */
// Convert array of meta data from renderer into array of real values.
unwrapArgs = function(sender, args) {
var metaToValue;
@ -160,7 +160,7 @@ unwrapArgs = function(sender, args) {
};
case 'function':
/* Cache the callbacks in renderer. */
// Cache the callbacks in renderer.
if (!sender.callbacks) {
sender.callbacks = new IDWeakMap;
sender.on('render-view-deleted', function() {
@ -230,7 +230,7 @@ callFunction = function(event, func, caller, args) {
};
/* Send by BrowserWindow when its render view is deleted. */
// Send by BrowserWindow when its render view is deleted.
process.on('ATOM_BROWSER_RELEASE_RENDER_VIEW', function(id) {
return objectsRegistry.clear(id);
@ -316,7 +316,7 @@ ipcMain.on('ATOM_BROWSER_MEMBER_CONSTRUCTOR', function(event, id, method, args)
args = unwrapArgs(event.sender, args);
constructor = objectsRegistry.get(id)[method];
/* Call new with array of arguments. */
// Call new with array of arguments.
obj = new (Function.prototype.bind.apply(constructor, [null].concat(args)));
return event.returnValue = valueToMeta(event.sender, obj);
} catch (error1) {