Commit graph

18 commits

Author SHA1 Message Date
Thiago de Arruda
6ff111a141 perf: don't use JSON to send the result of ipcRenderer.sendSync. (#8953)
* Don't use JSON to send the result of `ipcRenderer.sendSync`.

- Change the return type of AtomViewHostMsg_Message_Sync from `base::string16`
  to `base::ListValue`
- Adjust lib/browser/api/web-contents.js and /lib/renderer/api/ipc-renderer.js
  to wrap/unwrap return values to/from array, instead of
  serializing/deserializing JSON.

This change can greatly improve `ipcRenderer.sendSync` calls where the return
value contains Buffer instances, because those are converted to Array before
being serialized to JSON(which has no efficient way of representing byte
arrays).

A simple benchmark where remote.require('fs') was used to read a 16mb file got
at least 5x faster, not to mention it used a lot less memory.  This difference
tends increases with larger buffers.

* Don't base64 encode Buffers

* Don't allocate V8ValueConverter on the heap

* Replace hidden global.sandbox with NodeBindings::IsInitialized()

* Refactoring: check NodeBindings::IsInitialized() in V8ValueConverter

* Refactor problematic test to make it more reliable

* Add tests for NaN and Infinity
2018-06-13 17:38:31 +10:00
Milan Burda
2337237d58 Refactoring: use C++11 class member variable initialization 2018-05-22 00:18:38 +02:00
Shelley Vohr
53bdf22c85
clang-format atom files 2018-04-18 20:48:45 -04:00
Aleksei Kuzmin
cc350efbd8 Remove base::BinaryValue
https://codereview.chromium.org/2799093006
2017-08-15 16:19:20 +03:00
Cheng Zhao
50e3bfa764 Fix API changes of base::Value 2017-04-27 16:34:52 +09:00
Thiago de Arruda
a6e4867111 Handle Buffer deserialization in sandboxed renderers
In sandboxed renderers we use browserify to provide a node-like environment. The
Buffer class used by browserify is actually just a wrapper around Uint8Array,
but to deserialize Buffer correctly we must expose the class as a hidden value
and use it in V8ValueConverter.
2017-03-16 13:20:09 -03:00
Kevin Sawicki
6285500cdc Sort includes alphabetically 2016-08-26 15:30:02 -07:00
Kevin Sawicki
50e2e26e4f Improve cycle detection in V8ValueConverter 2016-08-25 09:26:07 -07:00
Paul Betts
d2944c62a5 basictypes.h => macros.h 2016-03-10 17:06:21 +09:00
Robo
367d12402a ipc: allow passing date instances 2016-02-23 16:23:15 +05:30
Robo
5ff97c686a nativemate: handle binary types in v8 value conversion 2015-10-13 01:13:59 +05:30
Cheng Zhao
ebb1ddc0df Support converting Buffer to Value 2015-08-12 15:39:33 +08:00
Cheng Zhao
d78efe7c22 Use Local instead of Handle 2015-05-22 19:11:22 +08:00
Cheng Zhao
95dd73bd1d Add maximum depth when converting V8 object to base::Value 2014-12-16 16:46:23 -08:00
Kevin Sawicki
b6b6fc3bfd Remove All Rights Reserved after GitHub copyright
Closes #762
2014-10-31 11:17:05 -07:00
Cheng Zhao
cd4c5d976b Adapt to API changes of Chromium and node. 2014-06-28 22:33:00 +08:00
Cheng Zhao
f176b2c58f Switch to use MIT license. 2014-05-04 20:29:08 +08:00
Cheng Zhao
5dae7b8658 Put converters under atom/common/native_mate_converters. 2014-04-17 13:45:14 +08:00
Renamed from atom/common/v8/v8_value_converter.h (Browse further)