Home | History | Annotate | Download | only in cpp

Lines Matching refs:v8

17 #include <v8.h>
50 v8::Handle<v8::Value> RadioStateGetter(v8::Local<v8::String> property,
51 const v8::AccessorInfo& info) {
52 return v8::Integer::New((int)gRadioState);
55 void RadioStateSetter(v8::Local<v8::String> property,
56 v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
61 v8::Handle<v8::Value> MsSleep(const v8::Arguments& args) {
65 v8::Handle<v8::Value> v8MsValue(args[0]->ToObject());
67 v8::Unlocker unlocker;
69 v8::Locker locker;
71 return v8::Undefined();
75 v8::Handle<v8::Value> Print(const v8::Arguments& args) {
81 v8::HandleScope handle_scope;
87 v8::String::Utf8Value strUtf8(args[i]);
93 return v8::Undefined();
139 char *CreateFileName(const v8::Arguments& args) {
140 v8::String::Utf8Value fileNameUtf8Value(args[0]);
152 v8::Handle<v8::Value> ReadFileToString(const v8::Arguments& args) {
154 v8::HandleScope handle_scope;
155 v8::Handle<v8::Value> retValue;
160 return v8::Undefined();
167 retValue = v8::String::New(buffer);
169 retValue = v8::Undefined();
177 v8::Handle<v8::Value> ReadFileToBuffer(const v8::Arguments& args) {
179 v8::HandleScope handle_scope;
180 v8::Handle<v8::Value> retValue;
185 return v8::Undefined();
197 retValue = v8::Undefined();
204 void ErrorCallback(v8::Handle<v8::Message> message,
205 v8::Handle<v8::Value> data) {
210 v8::Handle<v8::Value> Include(const v8::Arguments& args) {
212 v8::HandleScope handle_scope;
213 v8::Handle<v8::Value> retValue;
214 v8::TryCatch try_catch;
220 return v8::Undefined();
227 runJs(v8::Context::GetCurrent(), &try_catch, fileName, buffer);
229 retValue = v8::Undefined();
240 v8::Persistent<v8::Context> makeJsContext() {
241 v8::HandleScope handle_scope;
242 v8::TryCatch try_catch;
245 v8::V8::AddMessageListener(ErrorCallback);
249 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
250 global->SetAccessor(v8::String::New("gRadioState"),
252 global->Set(v8::String::New("msSleep"), v8::FunctionTemplate::New(MsSleep));
253 global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print));
254 global->Set(v8::String::New("readFileToBuffer"),
255 v8::FunctionTemplate::New(ReadFileToBuffer));
256 global->Set(v8::String::New("readFileToString"),
257 v8::FunctionTemplate::New(ReadFileToString));
258 global->Set(v8::String::New("sendRilRequestComplete"),
259 v8::FunctionTemplate::New(SendRilRequestComplete));
260 global->Set(v8::String::New("sendRilUnsolicitedResponse"),
261 v8::FunctionTemplate::New(SendRilUnsolicitedResponse));
262 global->Set(v8::String::New("sendCtrlRequestComplete"),
263 v8::FunctionTemplate::New(SendCtrlRequestComplete));
264 global->Set(v8::String::New("include"), v8::FunctionTemplate::New(Include));
270 v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
285 void runJs(v8::Handle<v8::Context> context, v8::TryCatch *try_catch,
287 v8::HandleScope handle_scope;
290 v8::Handle<v8::Script> script = v8::Script::Compile(
291 v8::String::New(code), v8::String::New(fileName));
296 v8::Handle<v8::Value> result = script->Run();
303 void testRadioState(v8::Handle<v8::Context> context) {
305 v8::HandleScope handle_scope;
307 v8::TryCatch try_catch;
320 void testMsSleep(v8::Handle<v8::Context> context) {
322 v8::HandleScope handle_scope;
324 v8::TryCatch try_catch;
336 void testPrint(v8::Handle<v8::Context> context) {
338 v8::HandleScope handle_scope;
340 v8::TryCatch try_catch;
347 void testCompileError(v8::Handle<v8::Context> context) {
349 v8::HandleScope handle_scope;
351 v8::TryCatch try_catch;
359 void testRuntimeError(v8::Handle<v8::Context> context) {
361 v8::HandleScope handle_scope;
363 v8::TryCatch try_catch;
390 void testReadFileToStringBuffer(v8::Handle<v8::Context> context) {
392 v8::HandleScope handle_scope;
394 v8::TryCatch try_catch;
405 void testJsSupport(v8::Handle<v8::Context> context) {