Exemplo n.º 1
0
DOMDataStore& DOMData::getCurrentStore()
{
    V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
    if (UNLIKELY(data->domDataStore() != 0))
        return *data->domDataStore();
    V8IsolatedContext* context = V8IsolatedContext::getEntered();
    if (UNLIKELY(context != 0))
        return *context->world()->domDataStore();
    return getDefaultStore();
}
DOMDataStore& MainThreadDOMData::getMainThreadStore()
{
    // This is broken out as a separate non-virtual method from getStore()
    // so that it can be inlined by getCurrentMainThreadStore, which is
    // a hot spot in Dromaeo DOM tests.
    ASSERT(WTF::isMainThread());
    V8IsolatedContext* context = V8IsolatedContext::getEntered();
    if (UNLIKELY(context != 0))
        return *context->world()->domDataStore();
    return m_defaultStore;
}
v8::Handle<v8::Object> V8DOMWrapper::getWrapperSlow(Node* node)
{
    V8IsolatedContext* context = V8IsolatedContext::getEntered();
    if (LIKELY(!context)) {
        v8::Persistent<v8::Object>* wrapper = node->wrapper();
        if (!wrapper)
            return v8::Handle<v8::Object>();
        return *wrapper;
    }
    DOMNodeMapping& domNodeMap = context->world()->domDataStore()->domNodeMap();
    return domNodeMap.get(node);
}