Ignore:
Timestamp:
Oct 19, 2013, 6:58:49 AM (12 years ago)
Author:
[email protected]
Message:

Start passing RenderStyle around with PassRef.
<https://webkit.org/b/123051>

Source/WebCore:

Made the RenderStyle::create methods return PassRef<RenderStyle>
and RenderElement::setStyle take a PassRef<RenderStyle>.

Reviewed by Darin Adler.

Source/WTF:

Added some new PassRef tricks to make this patch possible.

Reviewed by Darin Adler.

  • wtf/PassRef.h:

(WTF::PassRef::get):

Added a get() helper to facilitate writing functions that
construct a new object and call some functions on it before
returning it.

(WTF::PassRef::dropRef):

This will deref() the referenced object and mark the PassRef
as "passed." This is used in code paths where the PassRef is
going to go out of scope with nobody to take it over.

(WTF::PassRef::leakRef):

Renamed takeReference() to leakRef() and made it public so
we don't have to awkwardly sink the PassRef into a Ref for
e.g static locals.

  • wtf/RefPtr.h:

(WTF::RefPtr::releaseNonNull):

Added RefPtr::releaseNonNull() for a convenient way of creating
a PassRef<T> from a RefPtr<T>. This function may only be called
if the RefPtr is known to be non-null.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/rendering/RenderImage.cpp

    r157408 r157665  
    8585    // the pseudo element doesn't change the size of the image. In all other cases we
    8686    // can just share the style.
    87     RefPtr<RenderStyle> style = RenderStyle::create();
    88     style->inheritFrom(pseudoStyle.get());
    89     setStyle(style.release());
     87    auto style = RenderStyle::create();
     88    style.get().inheritFrom(pseudoStyle.get());
     89    setStyle(std::move(style));
    9090}
    9191
Note: See TracChangeset for help on using the changeset viewer.