Commit graph

33 commits

Author SHA1 Message Date
Cheng Zhao
d19e62d867 Erase window from weak map immediately after it's destroyed.
Otherwise it could happend that developers accessed the window after
it's destroyed but before it's GCed.
2013-05-20 14:55:46 +08:00
Cheng Zhao
66c35e4517 Add BrowserWindow.fromProcessIdAndRoutingId API. 2013-05-17 21:53:37 +08:00
Cheng Zhao
64a8664ffe Fix places where Window should be BrowserWindow. 2013-05-15 22:17:27 +08:00
Cheng Zhao
1bace4abb6 Improve error reporting in RPC by printing stack trace. 2013-05-14 20:00:44 +08:00
Cheng Zhao
35441ad8fb The unwrapArgs relies on the valueToMeta function. 2013-05-04 22:59:32 +08:00
Cheng Zhao
e7547363e2 Check whether id is valid when adding to weak map.
It's possible that the object has been added to weak map before and then
erased, so having an id property doesn't mean it's added in the weak map.
2013-05-04 22:57:17 +08:00
Cheng Zhao
6bf0d5d798 Modify funtion's names to make RPC code more easy to understand. 2013-05-04 21:38:25 +08:00
Cheng Zhao
36c260f4d5 Resupport cross-process callback.
It seems that it's avoidable to make callback cross-process when we
start to emitting events for GUI elements, without this feature our
implementation will be much more complicated. I will find a way to warn
about resources leak in browser.
2013-05-04 17:01:28 +08:00
Cheng Zhao
188bb5e225 Pass remote objects from renderer to browser by ID. 2013-05-03 21:51:06 +08:00
Cheng Zhao
42f10a15d5 URL => Url, ID => Id in coffee script. 2013-05-03 15:36:25 +08:00
Cheng Zhao
31d6be0e63 Release resources in browser when renderer view is gonna unloaded. 2013-05-01 10:59:29 +08:00
Cheng Zhao
bcf6cd9f1b Drop support for cross-process callbacks.
Now it's forbidden for browser to store reference to objects (including
functions) in renderer, because when the renderer is destroyed, it's
extremely hard to clean all of corresponding objects in browser
correctly, which would cause very bad resources leak.
2013-04-30 22:37:54 +08:00
Cheng Zhao
a06c9b806b Add API to get any global variable from browser. 2013-04-30 16:27:14 +08:00
Cheng Zhao
af57d3be08 Uniform message names.
Messages sent to browser should be prefixed with ATOM_BROWSER_, and
messages sent to renderer should be prefixed with ATOM_RENDERER_.
2013-04-29 18:59:34 +08:00
Cheng Zhao
f1e15b49a9 Support passing callbacks from renderer to browser. 2013-04-29 18:24:37 +08:00
Cheng Zhao
948e50285d Use camelCase not under_score, I forgot it's coffee script. 2013-04-27 19:13:24 +08:00
Cheng Zhao
99f6a5678a Add remote.getCurrentWindow() API in renderer. 2013-04-27 19:06:41 +08:00
Cheng Zhao
b35946381b Make the RPC stuff code more understandable. 2013-04-26 23:58:49 +08:00
Cheng Zhao
da3d4c8408 Allow renderer to get object in browser for arbitrary times.
Now, when creating a remote object in renderer, the browser will
reference the corresponding object by storing it in a strong map. And
when the remote object in renderer is GCed, the corresponding object
will be dereferenced in browser.
2013-04-26 23:26:41 +08:00
Cheng Zhao
536b523232 Keep an id for each object added to global weak map. 2013-04-26 22:33:31 +08:00
Cheng Zhao
cc921fed1e Add remote.getObject API to get object in browser by it's ID. 2013-04-26 22:25:30 +08:00
Cheng Zhao
dded164052 Separate stored objects by the render view.
When a render view is closed, it's not guarrenteed that all objects'
weak callback would be called. So we must clean up all objects manually
after the render view gets closed.
2013-04-26 21:14:29 +08:00
Cheng Zhao
a513daae30 Enable idle GC in browser. 2013-04-25 19:41:23 +08:00
Cheng Zhao
3f6f2f4bea Tell browser to release remote object when the object is GCed. 2013-04-25 19:28:04 +08:00
Cheng Zhao
678a4953fa Better support of array type in RPC. 2013-04-25 16:03:29 +08:00
Cheng Zhao
2997eb9c77 Add renference links. 2013-04-25 15:12:56 +08:00
Cheng Zhao
d723173bc7 Initial RPC API implementation.
Basic usage is:
remote = require 'remote'
Window = remote.require 'window'
w = new Window { width: 800, height: 600 }

Still need to do:
* Beter support for Array type.
* Remote objects should cheat devtools.
* Support cross-process callbacks.
2013-04-24 16:43:01 +08:00
Cheng Zhao
ef2056c3f5 Initial javascript startup code. 2013-04-15 15:39:54 +08:00
Cheng Zhao
a7516f3da5 Copy the default_app to bundle. 2013-04-14 23:24:46 +08:00
Cheng Zhao
ee420b1590 Write js codes in coffee script. 2013-04-14 22:48:35 +08:00
Cheng Zhao
0f6ece2d27 Add our own built-in native module system. 2013-04-14 15:36:48 +08:00
Cheng Zhao
3c96007131 Don't quit browser when get fatal js error. 2013-04-13 23:38:29 +08:00
Cheng Zhao
40307126d7 Load atom.js on startup. 2013-04-13 21:10:41 +08:00