| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 #ifndef V8_D8_H_ | 5 #ifndef V8_D8_H_ |
| 6 #define V8_D8_H_ | 6 #define V8_D8_H_ |
| 7 | 7 |
| 8 #ifndef V8_SHARED | 8 #ifndef V8_SHARED |
| 9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
| 10 #include "src/base/platform/time.h" | 10 #include "src/base/platform/time.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 static Local<String> ReadFromStdin(Isolate* isolate); | 394 static Local<String> ReadFromStdin(Isolate* isolate); |
| 395 static void ReadLine(const v8::FunctionCallbackInfo<v8::Value>& args) { | 395 static void ReadLine(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 396 args.GetReturnValue().Set(ReadFromStdin(args.GetIsolate())); | 396 args.GetReturnValue().Set(ReadFromStdin(args.GetIsolate())); |
| 397 } | 397 } |
| 398 static void Load(const v8::FunctionCallbackInfo<v8::Value>& args); | 398 static void Load(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 399 static void WorkerNew(const v8::FunctionCallbackInfo<v8::Value>& args); | 399 static void WorkerNew(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 400 static void WorkerPostMessage( | 400 static void WorkerPostMessage( |
| 401 const v8::FunctionCallbackInfo<v8::Value>& args); | 401 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 402 static void WorkerGetMessage(const v8::FunctionCallbackInfo<v8::Value>& args); | 402 static void WorkerGetMessage(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 403 static void WorkerTerminate(const v8::FunctionCallbackInfo<v8::Value>& args); | 403 static void WorkerTerminate(const v8::FunctionCallbackInfo<v8::Value>& args); |
| 404 // The OS object on the global object contains methods for performing | |
| 405 // operating system calls: | |
| 406 // | |
| 407 // os.system("program_name", ["arg1", "arg2", ...], timeout1, timeout2) will | |
| 408 // run the command, passing the arguments to the program. The standard output | |
| 409 // of the program will be picked up and returned as a multiline string. If | |
| 410 // timeout1 is present then it should be a number. -1 indicates no timeout | |
| 411 // and a positive number is used as a timeout in milliseconds that limits the | |
| 412 // time spent waiting between receiving output characters from the program. | |
| 413 // timeout2, if present, should be a number indicating the limit in | |
| 414 // milliseconds on the total running time of the program. Exceptions are | |
| 415 // thrown on timeouts or other errors or if the exit status of the program | |
| 416 // indicates an error. | |
| 417 // | |
| 418 // os.chdir(dir) changes directory to the given directory. Throws an | |
| 419 // exception/ on error. | |
| 420 // | |
| 421 // os.setenv(variable, value) sets an environment variable. Repeated calls to | |
| 422 // this method leak memory due to the API of setenv in the standard C library. | |
| 423 // | |
| 424 // os.umask(alue) calls the umask system call and returns the old umask. | |
| 425 // | |
| 426 // os.mkdirp(name, mask) creates a directory. The mask (if present) is anded | |
| 427 // with the current umask. Intermediate directories are created if necessary. | |
| 428 // An exception is not thrown if the directory already exists. Analogous to | |
| 429 // the "mkdir -p" command. | |
| 430 static void System(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 431 static void ChangeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 432 static void SetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 433 static void UnsetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 434 static void SetUMask(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 435 static void MakeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 436 static void RemoveDirectory(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 437 | |
| 438 static void AddOSMethods(v8::Isolate* isolate, | |
| 439 Local<ObjectTemplate> os_template); | |
| 440 | 404 |
| 441 static const char* kPrompt; | 405 static const char* kPrompt; |
| 442 static ShellOptions options; | 406 static ShellOptions options; |
| 443 static ArrayBuffer::Allocator* array_buffer_allocator; | 407 static ArrayBuffer::Allocator* array_buffer_allocator; |
| 444 | 408 |
| 445 private: | 409 private: |
| 446 static Global<Context> evaluation_context_; | 410 static Global<Context> evaluation_context_; |
| 447 static base::OnceType quit_once_; | 411 static base::OnceType quit_once_; |
| 448 #ifndef V8_SHARED | 412 #ifndef V8_SHARED |
| 449 static Global<Context> utility_context_; | 413 static Global<Context> utility_context_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 468 static void RunShell(Isolate* isolate); | 432 static void RunShell(Isolate* isolate); |
| 469 static bool SetOptions(int argc, char* argv[]); | 433 static bool SetOptions(int argc, char* argv[]); |
| 470 static Local<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); | 434 static Local<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); |
| 471 }; | 435 }; |
| 472 | 436 |
| 473 | 437 |
| 474 } // namespace v8 | 438 } // namespace v8 |
| 475 | 439 |
| 476 | 440 |
| 477 #endif // V8_D8_H_ | 441 #endif // V8_D8_H_ |
| OLD | NEW |