Chromium Code Reviews| Index: include/v8.h |
| diff --git a/include/v8.h b/include/v8.h |
| index e4fffadc81b6c29e44d7801eaefc14535bdce35f..dc2e6fef7592dfce6adc4f6dd7f2cf06bab73234 100644 |
| --- a/include/v8.h |
| +++ b/include/v8.h |
| @@ -2816,13 +2816,13 @@ class V8EXPORT Isolate { |
| /** |
| * Associate embedder-specific data with the isolate |
| */ |
| - void SetData(void* data); |
| + inline void SetData(void* data); |
| /** |
| * Retrive embedder-specific data from the isolate. |
|
Sven Panne
2012/04/24 14:14:32
Not caused by you, but a correct spelling would be
Michael Starzinger
2012/04/24 14:33:19
Done.
|
| * Returns NULL if SetData has never been called. |
| */ |
| - void* GetData(); |
| + inline void* GetData(); |
| private: |
| Isolate(); |
| @@ -3961,6 +3961,18 @@ class Internals { |
| return *reinterpret_cast<int*>(addr) == 1; |
| } |
| + static inline void SetEmbedderData(v8::Isolate* isolate, void* data) { |
| + uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + |
| + kIsolateEmbedderDataOffset; |
| + *reinterpret_cast<void**>(addr) = data; |
| + } |
| + |
| + static inline void* GetEmbedderData(v8::Isolate* isolate) { |
| + uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + |
| + kIsolateEmbedderDataOffset; |
| + return *reinterpret_cast<void**>(addr); |
| + } |
| + |
| static inline internal::Object** GetRoot(v8::Isolate* isolate, int index) { |
| uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset; |
| return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize); |
| @@ -4424,6 +4436,18 @@ Handle<Boolean> False(Isolate* isolate) { |
| } |
| +void Isolate::SetData(void* data) { |
| + typedef internal::Internals I; |
| + I::SetEmbedderData(this, data); |
| +} |
| + |
| + |
| +void* Isolate::GetData() { |
| + typedef internal::Internals I; |
| + return I::GetEmbedderData(this); |
| +} |
| + |
| + |
| /** |
| * \example shell.cc |
| * A simple shell that takes a list of expressions on the |