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 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2403 * V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer. | 2403 * V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer. |
2404 * | 2404 * |
2405 * This API is experimental and may change significantly. | 2405 * This API is experimental and may change significantly. |
2406 */ | 2406 */ |
2407 class V8EXPORT Allocator { // NOLINT | 2407 class V8EXPORT Allocator { // NOLINT |
2408 public: | 2408 public: |
2409 virtual ~Allocator() {} | 2409 virtual ~Allocator() {} |
2410 | 2410 |
2411 /** | 2411 /** |
2412 * Allocate |length| bytes. Return NULL if allocation is not successful. | 2412 * Allocate |length| bytes. Return NULL if allocation is not successful. |
| 2413 * Memory should be initialized to zeroes. |
2413 */ | 2414 */ |
2414 virtual void* Allocate(size_t length) = 0; | 2415 virtual void* Allocate(size_t length) = 0; |
| 2416 |
| 2417 /** |
| 2418 * Allocate |length| bytes. Return NULL if allocation is not successful. |
| 2419 * Memory does not have to be initialized. |
| 2420 */ |
| 2421 virtual void* AllocateUninitialized(size_t length) { |
| 2422 // Override with call to |Allocate| for compatibility |
| 2423 // with legacy version. |
| 2424 return Allocate(length); |
| 2425 } |
| 2426 |
2415 /** | 2427 /** |
2416 * Free the memory pointed to |data|. That memory is guaranteed to be | 2428 * Free the memory pointed to |data|. That memory is guaranteed to be |
2417 * previously allocated by |Allocate|. | 2429 * previously allocated by |Allocate|. |
2418 */ | 2430 */ |
2419 virtual void Free(void* data) = 0; | 2431 virtual void Free(void* data) = 0; |
2420 }; | 2432 }; |
2421 | 2433 |
2422 /** | 2434 /** |
2423 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| | 2435 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| |
2424 * returns an instance of this class, populated, with a pointer to data | 2436 * returns an instance of this class, populated, with a pointer to data |
(...skipping 4090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6515 | 6527 |
6516 | 6528 |
6517 } // namespace v8 | 6529 } // namespace v8 |
6518 | 6530 |
6519 | 6531 |
6520 #undef V8EXPORT | 6532 #undef V8EXPORT |
6521 #undef TYPE_CHECK | 6533 #undef TYPE_CHECK |
6522 | 6534 |
6523 | 6535 |
6524 #endif // V8_H_ | 6536 #endif // V8_H_ |
OLD | NEW |