Commit graph

180 commits

Author SHA1 Message Date
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
d4d1230107 Should wrap WeakCallback with handle scope. 2013-04-26 21:28:41 +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
e91d4c7c99 Add WeakMap built-in module. 2013-04-25 21:46:04 +08:00
Cheng Zhao
bcfec7c8cd Notify creation and destruction of native objects. 2013-04-25 20:23:00 +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
cc37431a1f Add v8_util.setDestructor.
This API can monitor when the object is GCed by V8, this is required by
the RPC API since we want to make sure the remote object got destroied
when object in renderer is GCed.
2013-04-25 18:25:18 +08:00
Cheng Zhao
a7ddf57620 Cheat on the remote object's constructor name. 2013-04-25 16:36:28 +08:00
Cheng Zhao
ddad3e4846 Add built-in v8_util module for internal use. 2013-04-25 16:30:31 +08:00
Cheng Zhao
678a4953fa Better support of array type in RPC. 2013-04-25 16:03:29 +08:00
Cheng Zhao
ab4015ef51 Module names starting with atom_common_ can be loaded by both sides. 2013-04-25 15:36:01 +08:00
Cheng Zhao
70fe77ca34 Return object instead of function for remote object type. 2013-04-25 15:28:37 +08:00
Cheng Zhao
2997eb9c77 Add renference links. 2013-04-25 15:12:56 +08:00
Cheng Zhao
0692776020 No more C++ RecordedObject and ObjectsRegistry code.
All RPC API will be implemented in pure javascript.
2013-04-25 15:02:58 +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
f8899242c5 No more plan for ipc.sendSync in browser.
I want the browser to be fully asynchronous, so sending synchronous
messages from browser to renderer will be unacceptable.
2013-04-23 22:21:49 +08:00
Cheng Zhao
1b87a31940 Add ipc.sendSync in renderer. 2013-04-23 21:52:19 +08:00
Cheng Zhao
8f0b2b6363 small tune of IPC interface. 2013-04-23 20:57:14 +08:00
Cheng Zhao
d28f51fb9c Add getRoutingID and getProcessID for window API. 2013-04-23 17:21:34 +08:00
Cheng Zhao
16244e42e0 Use require('ipc').send to communicate between browser and renderer. 2013-04-23 12:18:07 +08:00
Cheng Zhao
c22d927b6f Messages from renderer will be emitted to the process object in browser. 2013-04-22 22:24:02 +08:00
Cheng Zhao
66a0abe799 Renderer can now use process.send to send messages to browser. 2013-04-22 21:32:48 +08:00
Cheng Zhao
a7c3bdbf5d Separate AtomBindings for renderer. 2013-04-22 16:27:52 +08:00
Cheng Zhao
2ba3ce740c Remove RemoteObject, C++ layer should only have basic bridges. 2013-04-22 16:16:55 +08:00
Cheng Zhao
db0717851d Simpler way of inheriting EventEmitter. 2013-04-22 16:11:56 +08:00
Cheng Zhao
3ae0c99ca9 Add the RemoteObject API in renderer. (not implemented yet) 2013-04-22 09:13:25 +08:00
Cheng Zhao
ebf5bf2d19 Remove recorded object from registry in desturctor. 2013-04-21 16:27:30 +08:00
Cheng Zhao
b0b72c36e4 Ignore api_messages.{cc,h} for cpplint. 2013-04-21 15:36:48 +08:00
Cheng Zhao
5948bff23f Share same native bindings code on both renderer and browser. 2013-04-21 14:53:26 +08:00
Cheng Zhao
993cf1cc61 Add API messages for IPC. 2013-04-21 11:01:04 +08:00
Cheng Zhao
683087fbc4 Record all objects created by API in browser. 2013-04-20 21:52:46 +08:00
Cheng Zhao
17a9c2aea5 💄 for cpplint. 2013-04-20 14:03:55 +08:00
Cheng Zhao
7f581973c3 Implement window.open. 2013-04-20 13:56:01 +08:00
Cheng Zhao
5fb5ce2251 Enable creating window with existing web contents. 2013-04-20 13:42:39 +08:00
Cheng Zhao
0b2b9d371e Remembers all opened web frames.
There is a hack in WebKit to switch to the creation context of exception
when under node context, so we need to remember all window contexts.

Remove this when we have multi-context node.
2013-04-20 13:05:23 +08:00
Cheng Zhao
34c4d734af Disable renderer sandbox. 2013-04-20 11:19:25 +08:00
Cheng Zhao
4c0a162963 Inject node bindings to renderer's DOM. 2013-04-20 11:13:06 +08:00
Cheng Zhao
855b42551d Improve the way to integrate libuv.
Now we poll libuv's events in embed thread by adding main loop's backend
fd to a new kqueue fd, instead of directly polling on main loop's
backend fd. In this way we can avoid dealing with one shot events
overselves.
2013-04-19 21:21:04 +08:00
Cheng Zhao
603ae8b62e Update to latest brightray. 2013-04-19 19:11:46 +08:00
Cheng Zhao
53dd742632 Add Window.url API. 2013-04-19 00:06:10 +08:00
Cheng Zhao
d3e4db7ba3 Emit 'page-title-updated' as javascript event for window. 2013-04-18 23:50:47 +08:00
Cheng Zhao
1309d04ca7 Emulate DOM's Event class. 2013-04-18 21:42:20 +08:00
Cheng Zhao
2d016785a7 Add observers list for NativeWindow. 2013-04-18 20:50:58 +08:00
Cheng Zhao
d508f711c6 Add convenient accessors for Window API. 2013-04-18 15:57:53 +08:00
Cheng Zhao
100c4a426b Complete a few APIs for getters. 2013-04-18 15:38:04 +08:00
Cheng Zhao
d06472b092 Add partial APIs for WebContents and NavigationController. 2013-04-18 15:09:53 +08:00