Correctly keep track of isolates for microtask execution

BUG=487155
R=haraken@chromium.org

Review URL: https://codereview.chromium.org/1161823002

git-svn-id: svn://svn.chromium.org/blink/trunk@195985 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void Document::setReadyState(ReadyState readyState)
{
    if (readyState == m_readyState)
        return;

    switch (readyState) {
    case Loading:
        if (!m_documentTiming.domLoading()) {
            m_documentTiming.setDomLoading(monotonicallyIncreasingTime());
        }
        break;
    case Interactive:
        if (!m_documentTiming.domInteractive())
            m_documentTiming.setDomInteractive(monotonicallyIncreasingTime());
        break;
    case Complete:
        if (!m_documentTiming.domComplete())
            m_documentTiming.setDomComplete(monotonicallyIncreasingTime());
        break;
    }

    m_readyState = readyState;
    dispatchEvent(Event::create(EventTypeNames::readystatechange));
}

void Document::setReadyState(ReadyState readyState)
{
    if (readyState == m_readyState)
        return;

    switch (readyState) {
    case Loading:
        if (!m_documentTiming.domLoading()) {
            m_documentTiming.setDomLoading(monotonicallyIncreasingTime());
        }
        break;
    case Interactive:
        if (!m_documentTiming.domInteractive())
            m_documentTiming.setDomInteractive(monotonicallyIncreasingTime());
        break;
    case Complete:
        if (!m_documentTiming.domComplete())
            m_documentTiming.setDomComplete(monotonicallyIncreasingTime());
        break;
    }

    m_readyState = readyState;
    dispatchEvent(Event::create(EventTypeNames::readystatechange));
}
