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. | |
2414 */ | 2413 */ |
2415 virtual void* Allocate(size_t length) = 0; | 2414 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 | |
2427 /** | 2415 /** |
2428 * Free the memory pointed to |data|. That memory is guaranteed to be | 2416 * Free the memory pointed to |data|. That memory is guaranteed to be |
2429 * previously allocated by |Allocate|. | 2417 * previously allocated by |Allocate|. |
2430 */ | 2418 */ |
2431 virtual void Free(void* data) = 0; | 2419 virtual void Free(void* data) = 0; |
2432 }; | 2420 }; |
2433 | 2421 |
2434 /** | 2422 /** |
2435 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| | 2423 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| |
2436 * returns an instance of this class, populated, with a pointer to data | 2424 * 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... |
6527 | 6515 |
6528 | 6516 |
6529 } // namespace v8 | 6517 } // namespace v8 |
6530 | 6518 |
6531 | 6519 |
6532 #undef V8EXPORT | 6520 #undef V8EXPORT |
6533 #undef TYPE_CHECK | 6521 #undef TYPE_CHECK |
6534 | 6522 |
6535 | 6523 |
6536 #endif // V8_H_ | 6524 #endif // V8_H_ |
OLD | NEW |