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 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2505 /** | 2505 /** |
2506 * Allocate |length| bytes. Return NULL if allocation is not successful. | 2506 * Allocate |length| bytes. Return NULL if allocation is not successful. |
2507 * Memory should be initialized to zeroes. | 2507 * Memory should be initialized to zeroes. |
2508 */ | 2508 */ |
2509 virtual void* Allocate(size_t length) = 0; | 2509 virtual void* Allocate(size_t length) = 0; |
2510 | 2510 |
2511 /** | 2511 /** |
2512 * Allocate |length| bytes. Return NULL if allocation is not successful. | 2512 * Allocate |length| bytes. Return NULL if allocation is not successful. |
2513 * Memory does not have to be initialized. | 2513 * Memory does not have to be initialized. |
2514 */ | 2514 */ |
2515 virtual void* AllocateUninitialized(size_t length) { | 2515 virtual void* AllocateUninitialized(size_t length) = 0; |
2516 // Override with call to |Allocate| for compatibility | |
2517 // with legacy version. | |
2518 return Allocate(length); | |
2519 } | |
2520 | |
2521 /** | 2516 /** |
2522 * Free the memory block of size |length|, pointed to by |data|. | 2517 * Free the memory block of size |length|, pointed to by |data|. |
2523 * That memory is guaranteed to be previously allocated by |Allocate|. | 2518 * That memory is guaranteed to be previously allocated by |Allocate|. |
2524 */ | 2519 */ |
2525 virtual void Free(void* data, size_t length) { | 2520 virtual void Free(void* data, size_t length) = 0; |
2526 // Override with call to |Free(void*)| for compatibility | |
2527 // with legacy version. | |
2528 Free(data); | |
2529 } | |
2530 | |
2531 /** | |
2532 * Deprecated. Never called directly by V8. | |
2533 * For compatibility with legacy version of this interface. | |
2534 */ | |
2535 virtual void Free(void* data); | |
2536 }; | 2521 }; |
2537 | 2522 |
2538 /** | 2523 /** |
2539 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| | 2524 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| |
2540 * returns an instance of this class, populated, with a pointer to data | 2525 * returns an instance of this class, populated, with a pointer to data |
2541 * and byte length. | 2526 * and byte length. |
2542 * | 2527 * |
2543 * The Data pointer of ArrayBuffer::Contents is always allocated with | 2528 * The Data pointer of ArrayBuffer::Contents is always allocated with |
2544 * Allocator::Allocate that is set with V8::SetArrayBufferAllocator. | 2529 * Allocator::Allocate that is set with V8::SetArrayBufferAllocator. |
2545 * | 2530 * |
(...skipping 3900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6446 */ | 6431 */ |
6447 | 6432 |
6448 | 6433 |
6449 } // namespace v8 | 6434 } // namespace v8 |
6450 | 6435 |
6451 | 6436 |
6452 #undef TYPE_CHECK | 6437 #undef TYPE_CHECK |
6453 | 6438 |
6454 | 6439 |
6455 #endif // V8_H_ | 6440 #endif // V8_H_ |
OLD | NEW |