Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: mojo/public/bindings/js/core.cc

Issue 68323004: Port Mojo's sample_service.cc to JavaScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/public/bindings/js/core.h" 5 #include "mojo/public/bindings/js/core.h"
6 6
7 #include "gin/arguments.h" 7 #include "gin/arguments.h"
8 #include "gin/array_buffer.h" 8 #include "gin/array_buffer.h"
9 #include "gin/converter.h" 9 #include "gin/converter.h"
10 #include "gin/dictionary.h" 10 #include "gin/dictionary.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 v8::FunctionTemplate::New(Wait)); 149 v8::FunctionTemplate::New(Wait));
150 templ->Set(gin::StringToSymbol(isolate, "waitMany"), 150 templ->Set(gin::StringToSymbol(isolate, "waitMany"),
151 v8::FunctionTemplate::New(WaitMany)); 151 v8::FunctionTemplate::New(WaitMany));
152 templ->Set(gin::StringToSymbol(isolate, "createMessagePipe"), 152 templ->Set(gin::StringToSymbol(isolate, "createMessagePipe"),
153 v8::FunctionTemplate::New(CreateMessagePipe)); 153 v8::FunctionTemplate::New(CreateMessagePipe));
154 templ->Set(gin::StringToSymbol(isolate, "writeMessage"), 154 templ->Set(gin::StringToSymbol(isolate, "writeMessage"),
155 v8::FunctionTemplate::New(WriteMessage)); 155 v8::FunctionTemplate::New(WriteMessage));
156 templ->Set(gin::StringToSymbol(isolate, "readMessage"), 156 templ->Set(gin::StringToSymbol(isolate, "readMessage"),
157 v8::FunctionTemplate::New(ReadMessage)); 157 v8::FunctionTemplate::New(ReadMessage));
158 158
159 templ->Set(gin::StringToSymbol(isolate, "kInvalidHandle"),
160 gin::ConvertToV8(isolate, mojo::kInvalidHandle));
161
159 templ->Set(gin::StringToSymbol(isolate, "RESULT_OK"), 162 templ->Set(gin::StringToSymbol(isolate, "RESULT_OK"),
160 gin::ConvertToV8(isolate, MOJO_RESULT_OK)); 163 gin::ConvertToV8(isolate, MOJO_RESULT_OK));
161 templ->Set(gin::StringToSymbol(isolate, "RESULT_CANCELLED"), 164 templ->Set(gin::StringToSymbol(isolate, "RESULT_CANCELLED"),
162 gin::ConvertToV8(isolate, MOJO_RESULT_CANCELLED)); 165 gin::ConvertToV8(isolate, MOJO_RESULT_CANCELLED));
163 templ->Set(gin::StringToSymbol(isolate, "RESULT_UNKNOWN"), 166 templ->Set(gin::StringToSymbol(isolate, "RESULT_UNKNOWN"),
164 gin::ConvertToV8(isolate, MOJO_RESULT_UNKNOWN)); 167 gin::ConvertToV8(isolate, MOJO_RESULT_UNKNOWN));
165 templ->Set(gin::StringToSymbol(isolate, "RESULT_INVALID_ARGUMENT"), 168 templ->Set(gin::StringToSymbol(isolate, "RESULT_INVALID_ARGUMENT"),
166 gin::ConvertToV8(isolate, MOJO_RESULT_INVALID_ARGUMENT)); 169 gin::ConvertToV8(isolate, MOJO_RESULT_INVALID_ARGUMENT));
167 templ->Set(gin::StringToSymbol(isolate, "RESULT_DEADLINE_EXCEEDED"), 170 templ->Set(gin::StringToSymbol(isolate, "RESULT_DEADLINE_EXCEEDED"),
168 gin::ConvertToV8(isolate, MOJO_RESULT_DEADLINE_EXCEEDED)); 171 gin::ConvertToV8(isolate, MOJO_RESULT_DEADLINE_EXCEEDED));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 gin::ConvertToV8(isolate, MOJO_READ_MESSAGE_FLAG_MAY_DISCARD)); 213 gin::ConvertToV8(isolate, MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
211 214
212 data->SetObjectTemplate(&g_core_wrapper_info, templ); 215 data->SetObjectTemplate(&g_core_wrapper_info, templ);
213 } 216 }
214 217
215 return templ; 218 return templ;
216 } 219 }
217 220
218 } // namespace js 221 } // namespace js
219 } // namespace mojo 222 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698