Commit graph

52 commits

Author SHA1 Message Date
Cheng Zhao
620c9fa109 remote.require should return the same object for the same module.
This is required to use jasmine to test methods of the remote module.
2013-07-23 11:59:07 +08:00
Cheng Zhao
008b8d404d Don't separate node bindings into renderer and browser part.
Since we are going to use embeding thread to implement message
integration on all platforms, we do not need to separate renderer and
browser anymore.
2013-07-22 16:05:35 +08:00
Cheng Zhao
ce569ebf78 Enable the UI thread in browser to receive synchronous messages.
This is required to send synchronous message from renderer to browser.
2013-07-10 12:36:02 +08:00
Cheng Zhao
803ec00378 Add dummy implementaions of node integration in Windows. 2013-07-04 21:18:28 +08:00
Cheng Zhao
8bdf06131b Separate the creation function of NodeBindings for renderer and browser.
On Windows the message loop integration would need two different
implementations.
2013-07-04 19:47:48 +08:00
Cheng Zhao
6bdf7c51b4 Don't rely on "iosfwd" for forward including std::string.
It seems that VS fails on this.
2013-07-01 21:56:46 +08:00
Cheng Zhao
5b80e14f38 typeof null can also be 'object'. 2013-06-27 19:33:53 +08:00
Cheng Zhao
6d187cbb7d Build atom-shell with ninja. 2013-06-19 21:34:43 +08:00
Cheng Zhao
bb69d99423 Use - as filename seperator for coffee script files. Fixes #15.
Also clean unused files and wrong file names.
2013-05-30 20:21:07 +08:00
Cheng Zhao
f3a8a0741c Use the new way of reporting exception in node context.
More on this can be found at:
3c0fc7ad9f
2013-05-23 13:49:13 +08:00
Cheng Zhao
1bace4abb6 Improve error reporting in RPC by printing stack trace. 2013-05-14 20:00:44 +08:00
Cheng Zhao
67f998357c Make the CallbacksRegistry a separate module, though rather small. 2013-05-05 20:30:38 +08:00
Cheng Zhao
f725927c44 Use cross-platform callbacks in the dialog API. 2013-05-05 20:24:20 +08:00
Cheng Zhao
d377cbfa74 Don't send ATOM_BROWSER_DEREFERENCE message if context is already gone.
It's possible that the object gets destructed after reloading, however
since we already released all objects in browser when unloading, it
would cause troubles when sending message in an unexist context. We just
rely on the closure to mark whether the context is gone.

A more suitable solution, however, is to restart renderer process when
doing reloading.
2013-05-04 23:00:57 +08:00
Cheng Zhao
84dc221b2e Clear listeners on process object when unloading.
The process object is created under node context, and it will live
through the reloading, so we are responsible for clearing the listeners
to make sure resources are not leaked.
2013-05-04 21:52:14 +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
73d4b01597 Cache remote.getCurrentWindow. 2013-05-03 21:14:28 +08:00
Cheng Zhao
4aeb5e1388 Add dialog API.
Supported APIs:
* openFile
* openMultiFiles
* openFolder
* saveAs

Each API is asynchronous and accepts a callback.
2013-05-03 19:31:24 +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
1f1f6abd78 💄 2013-04-29 19:56:12 +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
cc921fed1e Add remote.getObject API to get object in browser by it's ID. 2013-04-26 22:25:30 +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
a7ddf57620 Cheat on the remote object's constructor name. 2013-04-25 16:36:28 +08:00
Cheng Zhao
678a4953fa Better support of array type in RPC. 2013-04-25 16:03:29 +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
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
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
3ae0c99ca9 Add the RemoteObject API in renderer. (not implemented yet) 2013-04-22 09:13:25 +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
17a9c2aea5 💄 for cpplint. 2013-04-20 14:03:55 +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
4c0a162963 Inject node bindings to renderer's DOM. 2013-04-20 11:13:06 +08:00