Print this page
XXX review feedback from keith
XXX rework to avoid changing api
XXX well, it works now...
Split |
Close |
Expand all |
Collapse all |
--- old/./v8plus_impl.h
+++ new/./v8plus_impl.h
1 1 /*
2 2 * Copyright (c) 2012 Joyent, Inc. All rights reserved.
3 3 */
4 4
5 5 #ifndef _V8PLUS_IMPL_H
6 6 #define _V8PLUS_IMPL_H
7 7
8 8 #include <sys/ccompile.h>
9 9 #include <stdarg.h>
10 10 #include <libnvpair.h>
11 11 #include <v8.h>
12 12 #include <unordered_map>
13 13 #include "v8plus_glue.h"
14 14
15 15 /*
16 16 * STOP!
17 17 *
18 18 * Do not #include this header in code that consumes v8+. This is a private
19 19 * implementation header for use by v8+ internal C++ code. It cannot be
20 20 * included from C code and contains nothing usable by consumers.
21 21 */
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
22 22
23 23 #define V8PLUS_THROW(_t, _e, _f, _args...) \
24 24 v8::ThrowException(v8plus::exception((_t), (_e), (_f), ## _args))
25 25 #define V8PLUS_THROW_DEFAULT() V8PLUS_THROW(NULL, NULL, NULL)
26 26 #define V8PLUS_THROW_DECORATED(_e) V8PLUS_THROW(NULL, (_e), NULL)
27 27
28 28 #if NODE_MINOR_VERSION > 7 || NODE_MAJOR_VERSION > 0
29 29 #define NODE_MAKECALLBACK_RETURN
30 30 #endif
31 31
32 +extern "C" boolean_t v8plus_in_event_thread(void);
33 +extern "C" void v8plus_crossthread_init(void);
34 +
32 35 namespace v8plus {
33 36
34 37 class ObjectWrap;
35 38
36 39 class ObjectWrap : public node::ObjectWrap {
37 40 public:
38 41 static void init(v8::Handle<v8::Object>);
39 42 static v8::Handle<v8::Value> cons(const v8::Arguments &);
40 43 static ObjectWrap *objlookup(const void *);
41 44 v8::Handle<v8::Value> call(const char *, int, v8::Handle<v8::Value>[]);
42 45 void public_Ref(void);
43 46 void public_Unref(void);
44 47
45 48 private:
46 49 static v8::Persistent<v8::Function> _constructor;
47 50 static v8plus_method_descr_t *_mtbl;
48 51 static v8plus_static_descr_t *_stbl;
49 52 static std::unordered_map<void *, ObjectWrap *> _objhash;
50 53 void *_c_impl;
51 54
52 55 ObjectWrap() : _c_impl(NULL) {};
53 56 ~ObjectWrap();
54 57
55 58 static v8::Handle<v8::Value> _new(const v8::Arguments &);
56 59 static v8::Handle<v8::Value> _entry(const v8::Arguments &);
57 60 static v8::Handle<v8::Value> _static_entry(const v8::Arguments &);
58 61 };
59 62
60 63 extern nvlist_t *v8_Arguments_to_nvlist(const v8::Arguments &);
61 64 extern v8::Handle<v8::Value> nvpair_to_v8_Value(const nvpair_t *);
62 65 extern v8::Local<v8::Value> exception(const char *, const nvlist_t *,
63 66 const char *, ...) __PRINTFLIKE(3);
64 67
65 68 }; /* namespace v8plus */
66 69
67 70 #endif /* _V8PLUS_IMPL_H */
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX