Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
| 6 * | 6 * |
| 7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
| 8 * | 8 * |
| 9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
| 10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
| (...skipping 3408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3419 /** | 3419 /** |
| 3420 * Create a new ArrayBuffer. Allocate |byte_length| bytes. | 3420 * Create a new ArrayBuffer. Allocate |byte_length| bytes. |
| 3421 * Allocated memory will be owned by a created ArrayBuffer and | 3421 * Allocated memory will be owned by a created ArrayBuffer and |
| 3422 * will be deallocated when it is garbage-collected, | 3422 * will be deallocated when it is garbage-collected, |
| 3423 * unless the object is externalized. | 3423 * unless the object is externalized. |
| 3424 */ | 3424 */ |
| 3425 static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length); | 3425 static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length); |
| 3426 | 3426 |
| 3427 /** | 3427 /** |
| 3428 * Create a new ArrayBuffer over an existing memory block. | 3428 * Create a new ArrayBuffer over an existing memory block. |
| 3429 * The created array buffer is immediately in externalized state. | 3429 * The created array buffer is by default immediately in externalized state. |
| 3430 * The memory block will not be reclaimed when a created ArrayBuffer | 3430 * The memory block will not be reclaimed when a created ArrayBuffer |
| 3431 * is garbage-collected. | 3431 * is garbage-collected. |
| 3432 */ | 3432 */ |
| 3433 static Local<ArrayBuffer> New(Isolate* isolate, void* data, | 3433 static Local<ArrayBuffer> New(Isolate* isolate, void* data, |
| 3434 size_t byte_length); | 3434 size_t byte_length, bool is_external = true); |
|
dcarney
2015/04/20 13:19:56
no bool args! use enum class outside of class (in
| |
| 3435 | 3435 |
| 3436 /** | 3436 /** |
| 3437 * Returns true if ArrayBuffer is extrenalized, that is, does not | 3437 * Returns true if ArrayBuffer is extrenalized, that is, does not |
| 3438 * own its memory block. | 3438 * own its memory block. |
| 3439 */ | 3439 */ |
| 3440 bool IsExternal() const; | 3440 bool IsExternal() const; |
| 3441 | 3441 |
| 3442 /** | 3442 /** |
| 3443 * Returns true if this ArrayBuffer may be neutered. | 3443 * Returns true if this ArrayBuffer may be neutered. |
| 3444 */ | 3444 */ |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 3456 * Make this ArrayBuffer external. The pointer to underlying memory block | 3456 * Make this ArrayBuffer external. The pointer to underlying memory block |
| 3457 * and byte length are returned as |Contents| structure. After ArrayBuffer | 3457 * and byte length are returned as |Contents| structure. After ArrayBuffer |
| 3458 * had been etxrenalized, it does no longer owns the memory block. The caller | 3458 * had been etxrenalized, it does no longer owns the memory block. The caller |
| 3459 * should take steps to free memory when it is no longer needed. | 3459 * should take steps to free memory when it is no longer needed. |
| 3460 * | 3460 * |
| 3461 * The memory block is guaranteed to be allocated with |Allocator::Allocate| | 3461 * The memory block is guaranteed to be allocated with |Allocator::Allocate| |
| 3462 * that has been set with V8::SetArrayBufferAllocator. | 3462 * that has been set with V8::SetArrayBufferAllocator. |
| 3463 */ | 3463 */ |
| 3464 Contents Externalize(); | 3464 Contents Externalize(); |
| 3465 | 3465 |
| 3466 /** | |
| 3467 * Get a pointer to the ArrayBuffer's underlying memory block without | |
| 3468 * externalizing it. If the ArrayBuffer is not externalized, this pointer | |
| 3469 * will become invalid as soon as the ArrayBuffer became garbage collected. | |
| 3470 * | |
| 3471 * The embedder should make sure to hold a strong reference to the | |
| 3472 * ArrayBuffer while accessing this pointer. | |
| 3473 * | |
| 3474 * The memory block is guaranteed to be allocated with |Allocator::Allocate|. | |
| 3475 */ | |
| 3476 Contents GetContents(); | |
| 3477 | |
| 3466 V8_INLINE static ArrayBuffer* Cast(Value* obj); | 3478 V8_INLINE static ArrayBuffer* Cast(Value* obj); |
| 3467 | 3479 |
| 3468 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; | 3480 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; |
| 3469 | 3481 |
| 3470 private: | 3482 private: |
| 3471 ArrayBuffer(); | 3483 ArrayBuffer(); |
| 3472 static void CheckCast(Value* obj); | 3484 static void CheckCast(Value* obj); |
| 3473 }; | 3485 }; |
| 3474 | 3486 |
| 3475 | 3487 |
| (...skipping 4655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8131 */ | 8143 */ |
| 8132 | 8144 |
| 8133 | 8145 |
| 8134 } // namespace v8 | 8146 } // namespace v8 |
| 8135 | 8147 |
| 8136 | 8148 |
| 8137 #undef TYPE_CHECK | 8149 #undef TYPE_CHECK |
| 8138 | 8150 |
| 8139 | 8151 |
| 8140 #endif // V8_H_ | 8152 #endif // V8_H_ |
| OLD | NEW |