v8js_class.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2013 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | http://www.opensource.org/licenses/mit-license.php MIT License |
  8. +----------------------------------------------------------------------+
  9. | Author: Jani Taskinen <[email protected]> |
  10. | Author: Patrick Reilly <[email protected]> |
  11. +----------------------------------------------------------------------+
  12. */
  13. #ifndef V8JS_CLASS_H
  14. #define V8JS_CLASS_H
  15. /* Abbreviate long type names */
  16. typedef v8::Persistent<v8::FunctionTemplate, v8::CopyablePersistentTraits<v8::FunctionTemplate> > v8js_tmpl_t;
  17. typedef v8::Persistent<v8::Object, v8::CopyablePersistentTraits<v8::Object> > v8js_persistent_obj_t;
  18. /* Forward declarations */
  19. struct v8js_v8object;
  20. struct v8js_accessor_ctx;
  21. /* {{{ Context container */
  22. struct v8js_ctx {
  23. zend_object std;
  24. v8::Persistent<v8::String> object_name;
  25. v8::Persistent<v8::Context> context;
  26. zend_bool report_uncaught;
  27. zval *pending_exception;
  28. int in_execution;
  29. v8::Isolate *isolate;
  30. long time_limit;
  31. bool time_limit_hit;
  32. long memory_limit;
  33. bool memory_limit_hit;
  34. v8::Persistent<v8::FunctionTemplate> global_template;
  35. zval *module_loader;
  36. std::vector<char *> modules_stack;
  37. std::vector<char *> modules_base;
  38. std::map<char *, v8js_persistent_obj_t> modules_loaded;
  39. std::map<const char *,v8js_tmpl_t> template_cache;
  40. std::map<zval *, v8js_persistent_obj_t> weak_objects;
  41. std::map<v8js_tmpl_t *, v8js_persistent_obj_t> weak_closures;
  42. std::list<v8js_v8object *> v8js_v8objects;
  43. std::vector<v8js_accessor_ctx *> accessor_list;
  44. char *tz;
  45. #ifdef ZTS
  46. void ***zts_ctx;
  47. #endif
  48. };
  49. /* }}} */
  50. #ifdef ZTS
  51. # define V8JS_TSRMLS_FETCH() TSRMLS_FETCH_FROM_CTX(((v8js_ctx *) isolate->GetData(0))->zts_ctx);
  52. #else
  53. # define V8JS_TSRMLS_FETCH()
  54. #endif
  55. PHP_MINIT_FUNCTION(v8js_class);
  56. #endif /* V8JS_CLASS_H */
  57. /*
  58. * Local variables:
  59. * tab-width: 4
  60. * c-basic-offset: 4
  61. * End:
  62. * vim600: noet sw=4 ts=4 fdm=marker
  63. * vim<600: noet sw=4 ts=4
  64. */