OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2407 matching lines...) Loading... |
2418 * Allocate |length| bytes. Return NULL if allocation is not successful. | 2418 * Allocate |length| bytes. Return NULL if allocation is not successful. |
2419 * Memory does not have to be initialized. | 2419 * Memory does not have to be initialized. |
2420 */ | 2420 */ |
2421 virtual void* AllocateUninitialized(size_t length) { | 2421 virtual void* AllocateUninitialized(size_t length) { |
2422 // Override with call to |Allocate| for compatibility | 2422 // Override with call to |Allocate| for compatibility |
2423 // with legacy version. | 2423 // with legacy version. |
2424 return Allocate(length); | 2424 return Allocate(length); |
2425 } | 2425 } |
2426 | 2426 |
2427 /** | 2427 /** |
2428 * Free the memory pointed to |data|. That memory is guaranteed to be | 2428 * Free the memory block of size |length|, pointed to by |data|. |
2429 * previously allocated by |Allocate|. | 2429 * That memory is guaranteed to be previously allocated by |Allocate|. |
2430 */ | 2430 */ |
2431 virtual void Free(void* data) = 0; | 2431 virtual void Free(void* data, size_t length) { |
| 2432 // Override with call to |Free(void*)| for compatibility |
| 2433 // with legacy version. |
| 2434 Free(data); |
| 2435 } |
| 2436 |
| 2437 /** |
| 2438 * Deprecated. Never called directly by V8. |
| 2439 * For compatibility with legacy version of this interface. |
| 2440 */ |
| 2441 virtual void Free(void* data); |
2432 }; | 2442 }; |
2433 | 2443 |
2434 /** | 2444 /** |
2435 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| | 2445 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| |
2436 * returns an instance of this class, populated, with a pointer to data | 2446 * returns an instance of this class, populated, with a pointer to data |
2437 * and byte length. | 2447 * and byte length. |
2438 * | 2448 * |
2439 * The Data pointer of ArrayBuffer::Contents is always allocated with | 2449 * The Data pointer of ArrayBuffer::Contents is always allocated with |
2440 * Allocator::Allocate that is set with V8::SetArrayBufferAllocator. | 2450 * Allocator::Allocate that is set with V8::SetArrayBufferAllocator. |
2441 * | 2451 * |
(...skipping 4085 matching lines...) Loading... |
6527 | 6537 |
6528 | 6538 |
6529 } // namespace v8 | 6539 } // namespace v8 |
6530 | 6540 |
6531 | 6541 |
6532 #undef V8EXPORT | 6542 #undef V8EXPORT |
6533 #undef TYPE_CHECK | 6543 #undef TYPE_CHECK |
6534 | 6544 |
6535 | 6545 |
6536 #endif // V8_H_ | 6546 #endif // V8_H_ |
OLD | NEW |