Changeset 173458 in webkit


Ignore:
Timestamp:
Sep 10, 2014 6:23:42 AM (10 years ago)
Author:
gyuyoung.kim@samsung.com
Message:

Use toDocument instead of static_cast<Document*>
https://bugs.webkit.org/show_bug.cgi?id=136694

Reviewed by Andy Estes.

Clean up static_cast<Document*>.

  • Modules/mediasource/SourceBuffer.cpp:

(WebCore::SourceBuffer::document):

  • Modules/webaudio/AudioContext.cpp:

(WebCore::AudioContext::document):

  • bindings/gobject/WebKitDOMPrivate.cpp:

(WebKit::wrap):

  • dom/ScriptExecutionContext.cpp:

(WebCore::ScriptExecutionContext::dispatchErrorEvent): Add a line to remove .get().

  • workers/DefaultSharedWorkerRepository.cpp:

(WebCore::SharedWorkerProxy::addToWorkerDocuments):

  • workers/WorkerMessagingProxy.cpp:

(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):

  • xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::document):
(WebCore::XMLHttpRequest::open):

Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r173457 r173458  
     12014-09-10  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
     2
     3        Use toDocument instead of static_cast<Document*>
     4        https://bugs.webkit.org/show_bug.cgi?id=136694
     5
     6        Reviewed by Andy Estes.
     7
     8        Clean up static_cast<Document*>.
     9
     10        * Modules/mediasource/SourceBuffer.cpp:
     11        (WebCore::SourceBuffer::document):
     12        * Modules/webaudio/AudioContext.cpp:
     13        (WebCore::AudioContext::document):
     14        * bindings/gobject/WebKitDOMPrivate.cpp:
     15        (WebKit::wrap):
     16        * dom/ScriptExecutionContext.cpp:
     17        (WebCore::ScriptExecutionContext::dispatchErrorEvent): Add a line to remove .get().
     18        * workers/DefaultSharedWorkerRepository.cpp:
     19        (WebCore::SharedWorkerProxy::addToWorkerDocuments):
     20        * workers/WorkerMessagingProxy.cpp:
     21        (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
     22        * xml/XMLHttpRequest.cpp:
     23        (WebCore::XMLHttpRequest::document):
     24        (WebCore::XMLHttpRequest::open):
     25
    1262014-09-10  Yusuke Suzuki  <utatane.tea@gmail.com>
    227
  • trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp

    r173318 r173458  
    17961796Document& SourceBuffer::document() const
    17971797{
    1798     ASSERT(scriptExecutionContext()->isDocument());
    1799     return *static_cast<Document*>(scriptExecutionContext());
     1798    ASSERT(scriptExecutionContext());
     1799    return *toDocument(scriptExecutionContext());
    18001800}
    18011801
  • trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp

    r163725 r173458  
    325325Document* AudioContext::document() const
    326326{
    327     ASSERT(m_scriptExecutionContext && m_scriptExecutionContext->isDocument());
    328     return static_cast<Document*>(m_scriptExecutionContext);
     327    ASSERT(m_scriptExecutionContext);
     328    return toDocument(m_scriptExecutionContext);
    329329}
    330330
  • trunk/Source/WebCore/bindings/gobject/WebKitDOMPrivate.cpp

    r167874 r173458  
    101101        return WEBKIT_DOM_NODE(wrapComment(static_cast<Comment*>(node)));
    102102    case Node::DOCUMENT_NODE:
    103         if (static_cast<Document*>(node)->isHTMLDocument())
     103        if (toDocument(node)->isHTMLDocument())
    104104            return WEBKIT_DOM_NODE(wrapHTMLDocument(static_cast<HTMLDocument*>(node)));
    105         return WEBKIT_DOM_NODE(wrapDocument(static_cast<Document*>(node)));
     105        return WEBKIT_DOM_NODE(wrapDocument(toDocument(node)));
    106106    case Node::DOCUMENT_TYPE_NODE:
    107107        return WEBKIT_DOM_NODE(wrapDocumentType(static_cast<DocumentType*>(node)));
  • trunk/Source/WebCore/dom/ScriptExecutionContext.cpp

    r173208 r173458  
    380380#if PLATFORM(IOS)
    381381    if (target == target->toDOMWindow() && isDocument()) {
    382         Settings* settings = static_cast<Document*>(this)->settings();
     382        Settings* settings = toDocument(this)->settings();
    383383        if (settings && !settings->shouldDispatchJavaScriptWindowOnErrorEvents())
    384384            return false;
  • trunk/Source/WebCore/dom/ScriptExecutionContext.h

    r173133 r173458  
    236236
    237237#define SCRIPT_EXECUTION_CONTEXT_TYPE_CASTS(ToValueTypeName) \
     238    template<typename T> inline ToValueTypeName* to##ToValueTypeName(const RefPtr<T>& context) { return to##ToValueTypeName(context.get()); } \
    238239    TYPE_CASTS_BASE(ToValueTypeName, ScriptExecutionContext, context, context->is##ToValueTypeName(), context.is##ToValueTypeName())
    239240
  • trunk/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp

    r170774 r173458  
    226226{
    227227    // Nested workers are not yet supported, so passed-in context should always be a Document.
    228     ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument());
     228    ASSERT_WITH_SECURITY_IMPLICATION(context);
    229229    ASSERT(!isClosing());
    230230    MutexLocker lock(m_workerDocumentsLock);
    231     Document* document = static_cast<Document*>(context);
    232     m_workerDocuments.add(document);
     231    m_workerDocuments.add(toDocument(context));
    233232}
    234233
  • trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp

    r170774 r173458  
    8383{
    8484    // FIXME: This need to be revisited when we support nested worker one day
    85     ASSERT_WITH_SECURITY_IMPLICATION(m_scriptExecutionContext->isDocument());
    86     Document* document = static_cast<Document*>(m_scriptExecutionContext.get());
     85    ASSERT_WITH_SECURITY_IMPLICATION(m_scriptExecutionContext);
     86    Document* document = toDocument(m_scriptExecutionContext);
    8787    GroupSettings* settings = 0;
    8888    if (document->page())
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r173254 r173458  
    155155Document* XMLHttpRequest::document() const
    156156{
    157     ASSERT_WITH_SECURITY_IMPLICATION(scriptExecutionContext()->isDocument());
    158     return static_cast<Document*>(scriptExecutionContext());
     157    ASSERT_WITH_SECURITY_IMPLICATION(scriptExecutionContext());
     158    return toDocument(scriptExecutionContext());
    159159}
    160160
     
    489489    bool shouldBypassMainWorldContentSecurityPolicy = false;
    490490    if (scriptExecutionContext()->isDocument()) {
    491         Document* document = static_cast<Document*>(scriptExecutionContext());
     491        Document* document = toDocument(scriptExecutionContext());
    492492        if (document->frame())
    493493            shouldBypassMainWorldContentSecurityPolicy = document->frame()->script().shouldBypassMainWorldContentSecurityPolicy();
Note: See TracChangeset for help on using the changeset viewer.