Home | History | Annotate | Download | only in cpp

Lines Matching refs:blob

82 // Each javascript Buffer object is backed by a Blob object.
83 // the Blob is just a C-level chunk of bytes.
90 typedef struct Blob_ Blob;
93 static inline Blob * blob_new(size_t length) {
95 Blob * blob = (Blob*) malloc(sizeof(Blob));
96 if (!blob) return NULL;
98 blob->data = (char*) malloc(length);
99 if (!blob->data) {
101 free(blob);
105 V8::AdjustAmountOfExternalAllocatedMemory(sizeof(Blob) + length);
106 blob->length = length;
107 blob->refs = 0;
109 return blob;
113 static inline void blob_ref(Blob *blob) {
114 blob->refs++;
118 static inline void blob_unref(Blob *blob) {
119 assert(blob->refs > 0);
120 if (--blob->refs == 0) {
122 //fprintf(stderr, "free %d bytes\n", blob->length);
123 V8::AdjustAmountOfExternalAllocatedMemory(-(sizeof(Blob) + blob->length));
124 free(blob->data);
125 free(blob);
126 DBG("blob_unref blob and its data freed");
132 // references in the underlying Blob with this ExternalAsciiStringResource.
137 blob_ = parent->blob();
159 Blob *blob_;
324 // There should be at least two references to the blob now - the parent