OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "nacl_io/devfs/jspipe_event_emitter.h" | 5 #include "nacl_io/devfs/jspipe_event_emitter.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return 0; | 143 return 0; |
144 } | 144 } |
145 | 145 |
146 Error JSPipeEventEmitter::SendMessageToJS(PP_Var operation, PP_Var payload) { | 146 Error JSPipeEventEmitter::SendMessageToJS(PP_Var operation, PP_Var payload) { |
147 if (!ppapi_ || !messaging_iface_ || !var_iface_ || !dict_iface_) | 147 if (!ppapi_ || !messaging_iface_ || !var_iface_ || !dict_iface_) |
148 return EIO; | 148 return EIO; |
149 | 149 |
150 // Create dict object which will be sent to JavaScript. | 150 // Create dict object which will be sent to JavaScript. |
151 PP_Var dict = dict_iface_->Create(); | 151 PP_Var dict = dict_iface_->Create(); |
152 | 152 |
153 // Set try keys in the dictionaty: 'pipe', 'operation', and 'payload' | 153 // Set three keys in the dictionary: 'pipe', 'operation', and 'payload' |
154 dict_iface_->Set(dict, pipe_key_, pipe_name_var_); | 154 dict_iface_->Set(dict, pipe_key_, pipe_name_var_); |
155 dict_iface_->Set(dict, operation_key_, operation); | 155 dict_iface_->Set(dict, operation_key_, operation); |
156 dict_iface_->Set(dict, payload_key_, payload); | 156 dict_iface_->Set(dict, payload_key_, payload); |
157 | 157 |
158 // Send the dict via PostMessage | 158 // Send the dict via PostMessage |
159 messaging_iface_->PostMessage(ppapi_->GetInstance(), dict); | 159 messaging_iface_->PostMessage(ppapi_->GetInstance(), dict); |
160 | 160 |
161 // Release the dict | 161 // Release the dict |
162 var_iface_->Release(dict); | 162 var_iface_->Release(dict); |
163 return 0; | 163 return 0; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 if (err != 0) | 299 if (err != 0) |
300 return err; | 300 return err; |
301 *out_bytes = len; | 301 *out_bytes = len; |
302 bytes_sent_ += len; | 302 bytes_sent_ += len; |
303 | 303 |
304 UpdateStatus_Locked(); | 304 UpdateStatus_Locked(); |
305 return 0; | 305 return 0; |
306 } | 306 } |
307 | 307 |
308 } // namespace nacl_io | 308 } // namespace nacl_io |
OLD | NEW |