Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 79 lines (65 sloc) 2.784 kb
60818b9 @ry Add missing copyright headers
ry authored
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
0c7bf81 @ry Abstract out HandleWrap class
ry authored
22 #ifndef HANDLE_WRAP_H_
23 #define HANDLE_WRAP_H_
24
5f04065 @bnoordhuis process: add _getActiveHandles(), _getActiveRequests()
bnoordhuis authored
25 #include "ngx-queue.h"
26
0c7bf81 @ry Abstract out HandleWrap class
ry authored
27 namespace node {
28
85404c5 @ry Move HandleWrap rules to one place
ry authored
29 // Rules:
30 //
31 // - Do not throw from handle methods. Set errno.
32 //
33 // - MakeCallback may only be made directly off the event loop.
34 // That is there can be no JavaScript stack frames underneith it.
35 // (Is there anyway to assert that?)
36 //
37 // - No use of v8::WeakReferenceCallback. The close callback signifies that
38 // we're done with a handle - external resources can be freed.
39 //
40 // - Reusable?
41 //
42 // - The uv_close_cb is used to free the c++ object. The close callback
43 // is not made into javascript land.
44 //
45 // - uv_ref, uv_unref counts are managed at this layer to avoid needless
46 // js/c++ boundary crossing. At the javascript layer that should all be
47 // taken care of.
48
0c7bf81 @ry Abstract out HandleWrap class
ry authored
49 class HandleWrap {
50 public:
51 static void Initialize(v8::Handle<v8::Object> target);
52 static v8::Handle<v8::Value> Close(const v8::Arguments& args);
3116522 @indutny child_process: spawn().ref() and spawn().unref()
indutny authored
53 static v8::Handle<v8::Value> Ref(const v8::Arguments& args);
7e62bc9 @ry Move process.stdout unref hack to handle_wrap.cc
ry authored
54 static v8::Handle<v8::Value> Unref(const v8::Arguments& args);
0c7bf81 @ry Abstract out HandleWrap class
ry authored
55
56 protected:
57 HandleWrap(v8::Handle<v8::Object> object, uv_handle_t* handle);
58 virtual ~HandleWrap();
59
187fe27 stdio binding + javascript to enable process.stdin.listen()
Igor Zinkovsky authored
60 virtual void SetHandle(uv_handle_t* h);
0c7bf81 @ry Abstract out HandleWrap class
ry authored
61
62 v8::Persistent<v8::Object> object_;
63
64 private:
5f04065 @bnoordhuis process: add _getActiveHandles(), _getActiveRequests()
bnoordhuis authored
65 friend v8::Handle<v8::Value> GetActiveHandles(const v8::Arguments&);
0c7bf81 @ry Abstract out HandleWrap class
ry authored
66 static void OnClose(uv_handle_t* handle);
5f04065 @bnoordhuis process: add _getActiveHandles(), _getActiveRequests()
bnoordhuis authored
67 ngx_queue_t handle_wrap_queue_;
0c7bf81 @ry Abstract out HandleWrap class
ry authored
68 // Using double underscore due to handle_ member in tcp_wrap. Probably
69 // tcp_wrap should rename it's member to 'handle'.
70 uv_handle_t* handle__;
039fac6 @bnoordhuis deps: upgrade libuv to a478847
bnoordhuis authored
71 bool unref_;
0c7bf81 @ry Abstract out HandleWrap class
ry authored
72 };
73
74
75 } // namespace node
76
77
78 #endif // HANDLE_WRAP_H_
Something went wrong with that request. Please try again.