diff options
author | James M Snell <jasnell@gmail.com> | 2017-12-14 23:33:21 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-12-18 22:11:19 +0300 |
commit | c0d6327dcf339bc934e589e1565470a7cba8fb1a (patch) | |
tree | f652a6c13f6dce6f60e211b1a8b0b81f38f7364c /src/node_file.h | |
parent | 2ca227f64238e8900d519310c69ac54d16a56729 (diff) |
fs: refactor After for easier maintainability
PR-URL: https://github.com/nodejs/node/pull/17689
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_file.h')
-rw-r--r-- | src/node_file.h | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/node_file.h b/src/node_file.h index 53515ac7558..db85451b67a 100644 --- a/src/node_file.h +++ b/src/node_file.h @@ -1,24 +1,3 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - #ifndef SRC_NODE_FILE_H_ #define SRC_NODE_FILE_H_ @@ -29,8 +8,11 @@ namespace node { +using v8::Context; +using v8::HandleScope; using v8::Local; using v8::Object; +using v8::Undefined; using v8::Value; namespace fs { @@ -93,6 +75,22 @@ class FSReqWrap: public ReqWrap<uv_fs_t> { DISALLOW_COPY_AND_ASSIGN(FSReqWrap); }; +class FSReqAfterScope { + public: + FSReqAfterScope(FSReqWrap* wrap, uv_fs_t* req); + ~FSReqAfterScope(); + + bool Proceed(); + + void Reject(uv_fs_t* req); + + private: + FSReqWrap* wrap_ = nullptr; + uv_fs_t* req_ = nullptr; + HandleScope handle_scope_; + Context::Scope context_scope_; +}; + } // namespace fs } // namespace node |