Skip to content

Commit b6875ad

Browse files
committed
Renamed browser-side to main process
renamed a few occurances of "web page" to "renderer" renamed a few files that had "browser" in their name to "main-process" note that there are still many occurances of web page.
1 parent 1804466 commit b6875ad

15 files changed

+103
-111
lines changed

docs/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* [Application distribution](tutorial/application-distribution.md)
44
* [Application packaging](tutorial/application-packaging.md)
55
* [Using native node modules](tutorial/using-native-node-modules.md)
6-
* [Debugging browser process](tutorial/debugging-browser-process.md)
6+
* [Debugging main process](tutorial/debugging-main-process.md)
77
* [Using Selenium and WebDriver](tutorial/using-selenium-and-webdriver.md)
88
* [DevTools extension](tutorial/devtools-extension.md)
99

@@ -25,28 +25,28 @@ Custom DOM elements:
2525
* [`<webview>` tag](api/web-view-tag.md)
2626
* [`window.open` function](api/window-open.md)
2727

28-
Modules for browser side:
28+
Modules for the main process:
2929

3030
* [app](api/app.md)
3131
* [auto-updater](api/auto-updater.md)
3232
* [browser-window](api/browser-window.md)
3333
* [content-tracing](api/content-tracing.md)
3434
* [dialog](api/dialog.md)
3535
* [global-shortcut](api/global-shortcut.md)
36-
* [ipc (browser)](api/ipc-browser.md)
36+
* [ipc (main process)](api/ipc-main-process.md)
3737
* [menu](api/menu.md)
3838
* [menu-item](api/menu-item.md)
3939
* [power-monitor](api/power-monitor.md)
4040
* [protocol](api/protocol.md)
4141
* [tray](api/tray.md)
4242

43-
Modules for web page:
43+
Modules for the renderer process (web page):
4444

4545
* [ipc (renderer)](api/ipc-renderer.md)
4646
* [remote](api/remote.md)
4747
* [web-frame](api/web-frame.md)
4848

49-
Modules for both sides:
49+
Modules for both processes:
5050

5151
* [clipboard](api/clipboard.md)
5252
* [crash-reporter](api/crash-reporter.md)

docs/api/auto-updater.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ server that you are requesting updates from. A common approach is to use query
5353
parameters, like this:
5454

5555
```javascript
56-
// On browser side
56+
// On the main process
5757
var app = require('app');
5858
var autoUpdater = require('auto-updater');
5959
autoUpdater.setFeedUrl('http://mycompany.com/myapp/latest?version=' + app.getVersion());

docs/api/browser-window.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,14 @@ Remove the devtools extension whose name is `name`.
224224
The `WebContents` object this window owns, all web page related events and
225225
operations would be done via it.
226226

227-
**Note:** Users should never store this object because it may becomes `null`
228-
when the web page has crashed.
227+
**Note:** Users should never store this object because it may become `null`
228+
when the renderer process (web page) has crashed.
229229

230230
### BrowserWindow.devToolsWebContents
231231

232232
Get the `WebContents` of devtools of this window.
233233

234-
**Note:** Users should never store this object because it may becomes `null`
234+
**Note:** Users should never store this object because it may become `null`
235235
when the devtools has been closed.
236236

237237
### BrowserWindow.id
@@ -241,16 +241,16 @@ Get the unique ID of this window.
241241
### BrowserWindow.destroy()
242242

243243
Force closing the window, the `unload` and `beforeunload` event won't be emitted
244-
for the web page, and `close` event would also not be emitted for this window,
245-
but it would guarantee the `closed` event to be emitted.
244+
for the renderer process (web page), and `close` event would also not be emitted
245+
for this window, but it would guarantee the `closed` event to be emitted.
246246

247-
You should only use this method when the web page has crashed.
247+
You should only use this method when the renderer process (web page) has crashed.
248248

249249
### BrowserWindow.close()
250250

251251
Try to close the window, this has the same effect with user manually clicking
252-
the close button of the window. The web page may cancel the close though, see
253-
the [close event](window#event-close).
252+
the close button of the window. The renderer process (web page) may cancel the
253+
close though, see the [close event](window#event-close).
254254

255255
### BrowserWindow.focus()
256256

@@ -327,11 +327,11 @@ Returns an array that contains window's width and height.
327327
* `width` Integer
328328
* `height` Integer
329329

330-
Resizes the window's client area (e.g. the web page) to `width` and `height`.
330+
Resizes the renderer's area (i.e. the web page) to `width` and `height`.
331331

332332
### BrowserWindow.getContentSize()
333333

334-
Returns an array that contains window's client area's width and height.
334+
Returns an array that contains the renderer's width and height.
335335

336336
### BrowserWindow.setMinimumSize(width, height)
337337

@@ -810,10 +810,10 @@ Executes editing command `replaceMisspelling` in page.
810810
Send `args..` to the web page via `channel` in asynchronous message, the web
811811
page can handle it by listening to the `channel` event of `ipc` module.
812812

813-
An example of sending messages from browser side to web pages:
813+
An example of sending messages from the main process to the renderer process:
814814

815815
```javascript
816-
// On browser side.
816+
// On the main process.
817817
var window = null;
818818
app.on('ready', function() {
819819
window = new BrowserWindow({width: 800, height: 600});
@@ -840,6 +840,6 @@ app.on('ready', function() {
840840
**Note:**
841841

842842
1. The IPC message handler in web pages do not have a `event` parameter, which
843-
is different from the handlers on browser side.
844-
2. There is no way to send synchronous messages from browser side to web pages,
845-
because it would be very easy to cause dead locks.
843+
is different from the handlers on the main process.
844+
2. There is no way to send synchronous messages from the main process to a
845+
renderer process, because it would be very easy to cause dead locks.

docs/api/content-tracing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ combination of `tracing.DEFAULT_OPTIONS`, `tracing.ENABLE_SYSTRACE`,
6363
Stop recording on all processes.
6464

6565
Child processes typically are caching trace data and only rarely flush and send
66-
trace data back to the browser process. That is because it may be an expensive
66+
trace data back to the main process. That is because it may be an expensive
6767
operation to send the trace data over IPC, and we would like to avoid much
6868
runtime overhead of tracing. So, to end tracing, we must asynchronously ask all
6969
child processes to flush any pending trace data.
@@ -106,7 +106,7 @@ is called back.
106106
Get the current monitoring traced data.
107107

108108
Child processes typically are caching trace data and only rarely flush and send
109-
trace data back to the browser process. That is because it may be an expensive
109+
trace data back to the main process. That is because it may be an expensive
110110
operation to send the trace data over IPC, and we would like to avoid much
111111
runtime overhead of tracing. So, to end tracing, we must asynchronously ask all
112112
child processes to flush any pending trace data.

docs/api/crash-reporter.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ sent or the crash reporter is not started, `null` will be returned.
3636

3737
The crash reporter will send the following data to the `submitUrl` as `POST`:
3838

39-
* `rept` String - eg. atom-shell-crash-service
39+
* `rept` String - e.g. 'atom-shell-crash-service'
4040
* `ver` String - The version of atom-shell
41-
* `platform` String - eg. win32
42-
* `process_type` String - eg. browser
41+
* `platform` String - e.g. 'win32'
42+
* `process_type` String - e.g. 'renderer'
4343
* `ptime` Number
4444
* `_version` String - The version in `package.json`
4545
* `_productName` String - The product name in the crashReporter `options` object
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
# ipc (browser)
1+
# ipc (main process)
22

3-
Handles asynchronous and synchronous message sent from web page.
3+
Handles asynchronous and synchronous message sent from a renderer process (web
4+
page).
45

5-
The messages sent from web page would be emitted to this module, the event name
6+
The messages sent from a renderer would be emitted to this module, the event name
67
is the `channel` when sending message. To reply a synchronous message, you need
78
to set `event.returnValue`, to send an asynchronous back to the sender, you can
89
use `event.sender.send(...)`.
910

10-
It's also possible to send messages from browser side to web pages, see
11-
[WebContents.send](browser-window.md#webcontentssendchannel-args) for more.
11+
It's also possible to send messages from main process to the renderer process,
12+
see [WebContents.send](browser-window.md#webcontentssendchannel-args) for more.
1213

1314
An example of sending and handling messages:
1415

1516
```javascript
16-
// In browser.
17+
// In main process.
1718
var ipc = require('ipc');
1819
ipc.on('asynchronous-message', function(event, arg) {
1920
console.log(arg); // prints "ping"
@@ -27,7 +28,7 @@ ipc.on('synchronous-message', function(event, arg) {
2728
```
2829

2930
```javascript
30-
// In web page.
31+
// In renderer process (web page).
3132
var ipc = require('ipc');
3233
console.log(ipc.sendSync('synchronous-message', 'ping')); // prints "pong"
3334

@@ -45,4 +46,4 @@ Assign to this to return an value to synchronous messages.
4546

4647
### Event.sender
4748

48-
The `WebContents` of the web page that has sent the message.
49+
The `WebContents` of the renderer that has sent the message.

docs/api/ipc-renderer.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
# ipc (renderer)
22

33
The `ipc` module provides a few methods so you can send synchronous and
4-
asynchronous messages to the browser, and also receive messages sent from
5-
browser. If you want to make use of modules of browser from renderer, you
6-
might consider using the [remote](remote.md) module.
4+
asynchronous messages to the main process, and also receive messages sent from
5+
main process. If you want to make use of modules of main process from renderer
6+
process, you might consider using the [remote](remote.md) module.
77

8-
See [ipc (browser)](ipc-browser.md) for examples.
8+
See [ipc (main process)](ipc-main-process.md) for examples.
99

1010
## ipc.send(channel[, args...])
1111

12-
Send `args..` to the web page via `channel` in asynchronous message, the browser
12+
Send `args..` to the renderer via `channel` in asynchronous message, the main
1313
process can handle it by listening to the `channel` event of `ipc` module.
1414

1515
## ipc.sendSync(channel[, args...])
1616

17-
Send `args..` to the web page via `channel` in synchronous message, and returns
18-
the result sent from browser. The browser process can handle it by listening to
17+
Send `args..` to the renderer via `channel` in synchronous message, and returns
18+
the result sent from main process. The main process can handle it by listening to
1919
the `channel` event of `ipc` module, and returns by setting `event.returnValue`.
2020

2121
**Note:** Usually developers should never use this API, since sending
22-
synchronous message would block the whole web page.
22+
synchronous message would block the whole renderer process.
2323

2424
## ipc.sendToHost(channel[, args...])
2525

2626
Like `ipc.send` but the message will be sent to the host page instead of the
27-
browser process.
27+
main process.
2828

2929
This is mainly used by the page in `<webview>` to communicate with host page.

docs/api/power-monitor.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# power-monitor
22

3-
The `power-monitor` module is used to monitor the power state change, you can
4-
only use it on the browser side.
3+
The `power-monitor` module is used to monitor the power state change. You can
4+
only use it on the main process.
55

66
An example is:
77

docs/api/process.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The `process` object in atom-shell has following differences between the one in
44
upstream node:
55

6-
* `process.type` String - Process's type, can be `browser` or `renderer`.
6+
* `process.type` String - Process's type, can be `browser` (i.e. main process) or `renderer`.
77
* `process.versions['atom-shell']` String - Version of atom-shell.
88
* `process.versions['chrome']` String - Version of Chromium.
99
* `process.resourcesPath` String - Path to JavaScript source code.

docs/api/remote.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# remote
22

33
The `remote` module provides a simple way to do inter-process communication
4-
between the renderer process and the browser process.
4+
between the renderer process and the main process.
55

66
In atom-shell, only GUI-related modules are available in the renderer process.
7-
Without the `remote` module, users who wanted to call a browser-side API in
7+
Without the `remote` module, users who wanted to call a main process API in
88
the renderer process would have to explicitly send inter-process messages
9-
to the browser process. With the `remote` module, users can invoke methods of
10-
browser-side object without explicitly sending inter-process messages,
9+
to the main process. With the `remote` module, users can invoke methods of
10+
main process object without explicitly sending inter-process messages,
1111
similar to Java's
1212
[RMI](http://en.wikipedia.org/wiki/Java_remote_method_invocation).
1313

@@ -23,43 +23,43 @@ win.loadUrl('https://github.com');
2323
## Remote objects
2424

2525
Each object (including functions) returned by the `remote` module represents an
26-
object in the browser process (we call it a remote object or remote function).
26+
object in the main process (we call it a remote object or remote function).
2727
When you invoke methods of a remote object, call a remote function, or create
2828
a new object with the remote constructor (function), you are actually sending
2929
synchronous inter-process messages.
3030

3131
In the example above, both `BrowserWindow` and `win` were remote objects and
3232
`new BrowserWindow` didn't create a `BrowserWindow` object in the renderer process.
33-
Instead, it created a `BrowserWindow` object in the browser process and returned the
33+
Instead, it created a `BrowserWindow` object in the main process and returned the
3434
corresponding remote object in the renderer process, namely the `win` object.
3535

3636
## Lifetime of remote objects
3737

3838
Atom-shell makes sure that as long as the remote object in the renderer process
3939
lives (in other words, has not been garbage collected), the corresponding object
40-
in the browser process would never be released. When the remote object has been
41-
garbage collected, the corresponding object in the browser process would be
40+
in the main process would never be released. When the remote object has been
41+
garbage collected, the corresponding object in the main process would be
4242
dereferenced.
4343

4444
If the remote object is leaked in renderer process (e.g. stored in a map but never
45-
freed), the corresponding object in the browser process would also be leaked,
45+
freed), the corresponding object in the main process would also be leaked,
4646
so you should be very careful not to leak remote objects.
4747

4848
Primary value types like strings and numbers, however, are sent by copy.
4949

50-
## Passing callbacks to browser
50+
## Passing callbacks to the main process
5151

52-
Some APIs in the browser process accept callbacks, and it would be attempting to
52+
Some APIs in the main process accept callbacks, and it would be attempting to
5353
pass callbacks when calling a remote function. The `remote` module does support
5454
doing this, but you should also be extremely careful with this.
5555

56-
First, in order to avoid deadlocks, the callbacks passed to the browser process
57-
are called asynchronously, so you should not expect the browser process to
56+
First, in order to avoid deadlocks, the callbacks passed to the main process
57+
are called asynchronously, so you should not expect the main process to
5858
get the return value of the passed callbacks.
5959

60-
Second, the callbacks passed to the browser process will not get released
60+
Second, the callbacks passed to the main process will not get released
6161
automatically after they are called. Instead, they will persistent until the
62-
browser process garbage-collects them.
62+
main process garbage-collects them.
6363

6464
For example, the following code seems innocent at first glance. It installs a
6565
callback for the `close` event on a remote object:
@@ -71,19 +71,19 @@ remote.getCurrentWindow().on('close', function() {
7171
});
7272
```
7373

74-
The problem is that the callback would be stored in the browser process until you
74+
The problem is that the callback would be stored in the main process until you
7575
explicitly uninstall it! So each time you reload your window, the callback would
7676
be installed again and previous callbacks would just leak. To make things
7777
worse, since the context of previously installed callbacks have been released,
78-
when the `close` event was emitted, exceptions would be raised in the browser process.
78+
when the `close` event was emitted, exceptions would be raised in the main process.
7979

8080
Generally, unless you are clear what you are doing, you should always avoid
81-
passing callbacks to the browser process.
81+
passing callbacks to the main process.
8282

8383
## Remote buffer
8484

8585
An instance of node's `Buffer` is an object, so when you get a `Buffer` from
86-
the browser process, what you get is indeed a remote object (let's call it remote
86+
the main process, what you get is indeed a remote object (let's call it remote
8787
buffer), and everything would just follow the rules of remote objects.
8888

8989
However you should remember that although a remote buffer behaves like the real
@@ -110,7 +110,7 @@ in fact it was a remote buffer, and it was converted to string before it was
110110
written to the file. Since `buf` contained binary data and could not be represented
111111
by a UTF-8 encoded string, the written file was corrupted.
112112

113-
The work-around is to write the `buf` in the browser process, where it is a real
113+
The work-around is to write the `buf` in the main process, where it is a real
114114
`Buffer`:
115115

116116
```javascript
@@ -131,7 +131,7 @@ too, and data corruption could happen when it contains binary data.
131131

132132
* `module` String
133133

134-
Returns the object returned by `require(module)` in the browser process.
134+
Returns the object returned by `require(module)` in the main process.
135135

136136
## remote.getCurrentWindow()
137137

@@ -142,10 +142,10 @@ belongs to.
142142

143143
* `name` String
144144

145-
Returns the global variable of `name` (e.g. `global[name]`) in the browser
145+
Returns the global variable of `name` (e.g. `global[name]`) in the main
146146
process.
147147

148148
## remote.process
149149

150-
Returns the `process` object in the browser process. This is the same as
150+
Returns the `process` object in the main process. This is the same as
151151
`remote.getGlobal('process')`, but gets cached.

0 commit comments

Comments
 (0)