Skip to content

Instantly share code, notes, and snippets.

@indutny indutny/1.patch Secret
Created Apr 28, 2013

Embed
What would you like to do?
diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc
index 782bdf9..6747409 100644
--- a/src/node_http_parser.cc
+++ b/src/node_http_parser.cc
@@ -243,7 +243,8 @@ public:
HTTP_CB(on_headers_complete) {
- Local<Value> cb = handle_->Get(on_headers_complete_sym);
+ static Object::CachedProperty prop(on_headers_complete_sym);
+ Local<Value> cb = handle_->Get(prop);
if (!cb->IsFunction())
return 0;
@@ -304,7 +305,8 @@ public:
HTTP_DATA_CB(on_body) {
HandleScope scope(node_isolate);
- Local<Value> cb = handle_->Get(on_body_sym);
+ static Object::CachedProperty prop(on_body_sym);
+ Local<Value> cb = handle_->Get(prop);
if (!cb->IsFunction())
return 0;
@@ -331,7 +333,8 @@ public:
if (num_fields_)
Flush(); // Flush trailing HTTP headers.
- Local<Value> cb = handle_->Get(on_message_complete_sym);
+ static Object::CachedProperty prop(on_message_complete_sym);
+ Local<Value> cb = handle_->Get(prop);
if (!cb->IsFunction())
return 0;
@@ -515,7 +518,8 @@ private:
void Flush() {
HandleScope scope(node_isolate);
- Local<Value> cb = handle_->Get(on_headers_sym);
+ static Object::CachedProperty prop(on_headers_sym);
+ Local<Value> cb = handle_->Get(prop);
if (!cb->IsFunction())
return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.