| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 #define V8_AS_STRING(x) V8_AS_STRING_IMPL(x) | 41 #define V8_AS_STRING(x) V8_AS_STRING_IMPL(x) |
| 42 #define V8_AS_STRING_IMPL(x) #x | 42 #define V8_AS_STRING_IMPL(x) #x |
| 43 | 43 |
| 44 #define V8_HIDDEN_PROPERTY_PREFIX "WebCore::HiddenProperty::" | 44 #define V8_HIDDEN_PROPERTY_PREFIX "WebCore::HiddenProperty::" |
| 45 | 45 |
| 46 #define V8_DEFINE_HIDDEN_PROPERTY(name) \ | 46 #define V8_DEFINE_HIDDEN_PROPERTY(name) \ |
| 47 v8::Handle<v8::String> V8HiddenPropertyName::name() \ | 47 v8::Handle<v8::String> V8HiddenPropertyName::name(v8::Isolate* isolate) \ |
| 48 { \ | 48 { \ |
| 49 v8::Isolate* isolate = v8::Isolate::GetCurrent(); \ | |
| 50 V8HiddenPropertyName* hiddenPropertyName = V8PerIsolateData::from(isolate)->
hiddenPropertyName(); \ | 49 V8HiddenPropertyName* hiddenPropertyName = V8PerIsolateData::from(isolate)->
hiddenPropertyName(); \ |
| 51 if (hiddenPropertyName->m_##name.IsEmpty()) { \ | 50 if (hiddenPropertyName->m_##name.IsEmpty()) { \ |
| 52 createString(V8_HIDDEN_PROPERTY_PREFIX V8_AS_STRING(name), &(hiddenPrope
rtyName->m_##name), isolate); \ | 51 createString(V8_HIDDEN_PROPERTY_PREFIX V8_AS_STRING(name), &(hiddenPrope
rtyName->m_##name), isolate); \ |
| 53 } \ | 52 } \ |
| 54 return v8::Local<v8::String>::New(isolate, hiddenPropertyName->m_##name); \ | 53 return v8::Local<v8::String>::New(isolate, hiddenPropertyName->m_##name); \ |
| 55 } | 54 } |
| 56 | 55 |
| 57 V8_HIDDEN_PROPERTIES(V8_DEFINE_HIDDEN_PROPERTY); | 56 V8_HIDDEN_PROPERTIES(V8_DEFINE_HIDDEN_PROPERTY); |
| 58 | 57 |
| 59 static v8::Handle<v8::String> hiddenReferenceName(const char* name, unsigned len
gth) | 58 static v8::Handle<v8::String> hiddenReferenceName(const char* name, unsigned len
gth) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 parent->SetHiddenValue(hiddenReferenceName(name, strlen(name)), child); | 70 parent->SetHiddenValue(hiddenReferenceName(name, strlen(name)), child); |
| 72 } | 71 } |
| 73 | 72 |
| 74 void V8HiddenPropertyName::createString(const char* key, v8::Persistent<v8::Stri
ng>* handle, v8::Isolate* isolate) | 73 void V8HiddenPropertyName::createString(const char* key, v8::Persistent<v8::Stri
ng>* handle, v8::Isolate* isolate) |
| 75 { | 74 { |
| 76 v8::HandleScope scope(isolate); | 75 v8::HandleScope scope(isolate); |
| 77 handle->Reset(isolate, v8::String::NewSymbol(key)); | 76 handle->Reset(isolate, v8::String::NewSymbol(key)); |
| 78 } | 77 } |
| 79 | 78 |
| 80 } // namespace WebCore | 79 } // namespace WebCore |
| OLD | NEW |