Commit graph

77 commits

Author SHA1 Message Date
Cheng Zhao
998e9792fb Make setImmediate have the same side effect with upstream node. 2013-12-15 19:09:00 +08:00
Cheng Zhao
0a84c30d3b Redirect window.onerror to uncaughtException. 2013-12-15 16:32:41 +08:00
Cheng Zhao
7ba03ce23d Add setImmediate function in renderer. 2013-12-15 16:21:23 +08:00
Cheng Zhao
aa3e8385df Set __filename to the html file in renderer. 2013-12-15 16:11:00 +08:00
Cheng Zhao
886ebdb002 Use node's Environment feature to add "require" in renderer. 2013-12-15 14:20:28 +08:00
Cheng Zhao
409a431892 Huge commit to use new V8 and Content APIs.
Still got a lots of linking errors!
2013-12-11 15:48:19 +08:00
Cheng Zhao
d82cfc023f 💄 There should be no space between & and type name. 2013-12-10 14:27:25 +08:00
Cheng Zhao
4ec4b01218 base/string16.h was moved to base/strings/string16.h. 2013-12-10 14:14:05 +08:00
Cheng Zhao
623e0f3ae4 Release render view's remote objects when it's deleted.
Privously we release them when the window is unloaded, which is not
correct since a render view can have multiple windows (or js contexts)
and when the unload event is emitted the render view could already have
gone.

This PR does the cleaning work purely in browser, so here is no need to
worry about renderer's life time.
2013-12-06 14:44:25 +08:00
Cheng Zhao
4a1ee39156 Get rid of manually converting to base::Value when possible. 2013-12-05 23:47:07 +08:00
Cheng Zhao
e5afa72b4d Fail quietly when getting null renderer view.
It happens when the window is closing.
2013-12-05 23:34:43 +08:00
Cheng Zhao
4625f051c8 Simplify V8 operations in renderer ipc code. 2013-12-05 22:12:27 +08:00
Cheng Zhao
11ca836afc Use the convient V8 wrapper in all files. 2013-09-24 09:41:54 +08:00
Cheng Zhao
a824c88352 Use same name convention in string16_conversions. 2013-09-23 23:00:58 +08:00
Cheng Zhao
ef4b36d621 Use string16 instead of std::string when sending IPC messages.
The underlying V8::String is represented in UTF18, by using string16 in
IPC messages we can avoid the overhead of encode conversion.
2013-09-20 22:55:42 +08:00
Cheng Zhao
ef5a4b5fe0 Pass synchronous messages by JSON string.
We are going to use IPC_MESSAGE_HANDLER_DELAY_REPLY to handle
synchronous messages but DictionaryValue is not copyable, so we pass the
JSON string instead.
2013-09-20 22:32:59 +08:00
Cheng Zhao
07b5039c64 Make sure all sync messages get a return value. 2013-09-20 21:39:07 +08:00
Cheng Zhao
b225a59a15 Prefer event.returnValue to event.result for sync messages. 2013-09-20 21:37:00 +08:00
Cheng Zhao
4223867dbc Send and receive the AtomViewHostMsg_UpdateDraggableRegions message. 2013-09-05 20:06:54 +08:00
Cheng Zhao
db890feb51 Don't pollute console with error stack. 2013-08-30 13:04:21 +08:00
Cheng Zhao
9e16e41bb3 Enable creating object from remote object's member. 2013-08-25 20:44:52 +08:00
Cheng Zhao
c86acc4cd7 Add remote.createFunctionWithReturnValue API. 2013-08-25 17:22:36 +08:00
Cheng Zhao
2fd91e8c96 Enable passing objects and arrays when calling remote function. 2013-08-14 21:51:51 +08:00
Cheng Zhao
cd19666307 Remove the useless remote.getObject API. 2013-07-29 16:35:25 +08:00
Cheng Zhao
51a632d7d9 Don't make use of the 'id' property when sending objects.
Fixes #43.
2013-07-26 16:40:29 +08:00
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