summaryrefslogtreecommitdiffstats
path: root/native_client_sdk/src
diff options
context:
space:
mode:
authorsbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-09 21:23:40 +0000
committersbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-09 21:23:40 +0000
commit4a0b72b686cd9f681336603587afd81253ee70cb (patch)
treeb83e2d24ebfb3b8a2c43f62d8325bddce3a6c567 /native_client_sdk/src
parent5a246fdb6c6426374a86d584cba59d84c786ca59 (diff)
downloadchromium_src-4a0b72b686cd9f681336603587afd81253ee70cb.zip
chromium_src-4a0b72b686cd9f681336603587afd81253ee70cb.tar.gz
chromium_src-4a0b72b686cd9f681336603587afd81253ee70cb.tar.bz2
[NaCl SDK] nacl_io: remove default prefix for /dev/tty messages
Also fix simple_hello_world example so that the stdout is correctly re-directed to chrome vis PostMessage. R=binji@chromium.org Review URL: https://codereview.chromium.org/18341024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210632 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk/src')
-rw-r--r--native_client_sdk/src/examples/common.js25
-rw-r--r--native_client_sdk/src/examples/getting_started/simple_hello_world/index.html2
-rw-r--r--native_client_sdk/src/libraries/nacl_io/mount_dev.cc1
3 files changed, 18 insertions, 10 deletions
diff --git a/native_client_sdk/src/examples/common.js b/native_client_sdk/src/examples/common.js
index 51a0164..1842055 100644
--- a/native_client_sdk/src/examples/common.js
+++ b/native_client_sdk/src/examples/common.js
@@ -19,9 +19,9 @@ var common = (function () {
* @param {string} path Directory name where .nmf file can be found.
* @param {number} width The width to create the plugin.
* @param {number} height The height to create the plugin.
- * @param {Object} optional dictionary of args to send to DidCreateInstance
+ * @param {Object} attrs Dictionary of attributes to set on the module.
*/
- function createNaClModule(name, tool, path, width, height, args) {
+ function createNaClModule(name, tool, path, width, height, attrs) {
var moduleEl = document.createElement('embed');
moduleEl.setAttribute('name', 'nacl_module');
moduleEl.setAttribute('id', 'nacl_module');
@@ -31,9 +31,9 @@ var common = (function () {
moduleEl.setAttribute('src', path + '/' + name + '.nmf');
// Add any optional arguments
- if (args) {
- for (var key in args) {
- moduleEl.setAttribute(key, args[key])
+ if (attrs) {
+ for (var key in attrs) {
+ moduleEl.setAttribute(key, attrs[key])
}
}
@@ -212,8 +212,9 @@ var common = (function () {
* @param {string} path Directory name where .nmf file can be found.
* @param {number} width The width to create the plugin.
* @param {number} height The height to create the plugin.
+ * @param {Object} attrs Optional dictionary of additional attributes.
*/
- function domContentLoaded(name, tool, path, width, height) {
+ function domContentLoaded(name, tool, path, width, height, attrs) {
// If the page loads before the Native Client module loads, then set the
// status message indicating that the module is still loading. Otherwise,
// do not change the status message.
@@ -226,7 +227,7 @@ var common = (function () {
width = typeof width !== 'undefined' ? width : 200;
height = typeof height !== 'undefined' ? height : 200;
attachDefaultListeners();
- createNaClModule(name, tool, path, width, height);
+ createNaClModule(name, tool, path, width, height, attrs);
} else {
// It's possible that the Native Client module onload event fired
// before the page's onload event. In this case, the status message
@@ -300,6 +301,14 @@ document.addEventListener('DOMContentLoaded', function() {
if (loadFunction) {
var toolchains = body.dataset.tools.split(' ');
var configs = body.dataset.configs.split(' ');
+ var attr_list = body.dataset.attrs.split(' ');
+ var atts = {}
+ for (var key in attr_list) {
+ var attr = attr_list[key].split('=');
+ var key = attr[0];
+ var value = attr[1];
+ attrs[key] = value;
+ }
var tc = toolchains.indexOf(searchVars.tc) !== -1 ?
searchVars.tc : toolchains[0];
@@ -309,7 +318,7 @@ document.addEventListener('DOMContentLoaded', function() {
var path = pathFormat.replace('{tc}', tc).replace('{config}', config);
loadFunction(body.dataset.name, tc, path, body.dataset.width,
- body.dataset.height);
+ body.dataset.height, attrs);
}
}
});
diff --git a/native_client_sdk/src/examples/getting_started/simple_hello_world/index.html b/native_client_sdk/src/examples/getting_started/simple_hello_world/index.html
index 5e2965f..8779f49 100644
--- a/native_client_sdk/src/examples/getting_started/simple_hello_world/index.html
+++ b/native_client_sdk/src/examples/getting_started/simple_hello_world/index.html
@@ -12,7 +12,7 @@ found in the LICENSE file.
<script type="text/javascript" src="common.js"></script>
<script type="text/javascript" src="example.js"></script>
</head>
-<body {{attrs}}>
+<body {{attrs}} data-attrs="ps_stdout=dev/tty">
<h1>{{title}}</h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2>
<p>The Hello World Stdio example is the simplest one in the SDK. It uses the
diff --git a/native_client_sdk/src/libraries/nacl_io/mount_dev.cc b/native_client_sdk/src/libraries/nacl_io/mount_dev.cc
index 78b5916..99d8834 100644
--- a/native_client_sdk/src/libraries/nacl_io/mount_dev.cc
+++ b/native_client_sdk/src/libraries/nacl_io/mount_dev.cc
@@ -196,7 +196,6 @@ Error ConsoleNode::Write(size_t offs,
}
TtyNode::TtyNode(Mount* mount) : NullNode(mount) {
- prefix_ = "_default_:";
pthread_cond_init(&is_readable_, NULL);
}