Changeset 158958 in webkit


Ignore:
Timestamp:
Nov 8, 2013 2:42:27 PM (10 years ago)
Author:
weinig@apple.com
Message:

Modernize FrameLoader a bit
https://bugs.webkit.org/show_bug.cgi?id=124073

Reviewed by Anders Carlsson.

  • loader/FrameLoader.cpp:
  • loader/FrameLoader.h:

Use std::unique_ptrs rather than OwnPtrs.

  • loader/MixedContentChecker.cpp:
  • loader/MixedContentChecker.h:

Switch to hold a Frame& rather than Frame*.

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r158956 r158958  
     12013-11-08  Sam Weinig  <sam@webkit.org>
     2
     3        Modernize FrameLoader a bit
     4        https://bugs.webkit.org/show_bug.cgi?id=124073
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * loader/FrameLoader.cpp:
     9        * loader/FrameLoader.h:
     10        Use std::unique_ptrs rather than OwnPtrs.
     11
     12        * loader/MixedContentChecker.cpp:
     13        * loader/MixedContentChecker.h:
     14        Switch to hold a Frame& rather than Frame*.
     15
    1162013-11-08  Zan Dobersek  <zdobersek@igalia.com>
    217
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r158867 r158958  
    177177class FrameLoader::FrameProgressTracker {
    178178public:
    179     static PassOwnPtr<FrameProgressTracker> create(Frame& frame) { return adoptPtr(new FrameProgressTracker(frame)); }
     179    explicit FrameProgressTracker(Frame& frame)
     180        : m_frame(frame)
     181        , m_inProgress(false)
     182    {
     183    }
     184
    180185    ~FrameProgressTracker()
    181186    {
     
    202207
    203208private:
    204     FrameProgressTracker(Frame& frame)
    205         : m_frame(frame)
    206         , m_inProgress(false)
    207     {
    208     }
    209 
    210209    Frame& m_frame;
    211210    bool m_inProgress;
     
    215214    : m_frame(frame)
    216215    , m_client(client)
    217     , m_policyChecker(adoptPtr(new PolicyChecker(frame)))
    218     , m_history(adoptPtr(new HistoryController(frame)))
     216    , m_policyChecker(std::make_unique<PolicyChecker>(frame))
     217    , m_history(std::make_unique<HistoryController>(frame))
    219218    , m_notifier(frame)
    220     , m_subframeLoader(adoptPtr(new SubframeLoader(frame)))
    221     , m_icon(adoptPtr(new IconController(frame)))
    222     , m_mixedContentChecker(&frame)
     219    , m_subframeLoader(std::make_unique<SubframeLoader>(frame))
     220    , m_icon(std::make_unique<IconController>(frame))
     221    , m_mixedContentChecker(frame)
    223222    , m_state(FrameStateProvisional)
    224223    , m_loadType(FrameLoadTypeStandard)
     
    236235    , m_shouldCallCheckCompleted(false)
    237236    , m_shouldCallCheckLoadComplete(false)
    238     , m_opener(0)
     237    , m_opener(nullptr)
    239238    , m_didPerformFirstNavigation(false)
    240239    , m_loadingFromCachedPage(false)
     
    247246FrameLoader::~FrameLoader()
    248247{
    249     setOpener(0);
     248    setOpener(nullptr);
    250249
    251250    HashSet<Frame*>::iterator end = m_openedFrames.end();
     
    269268
    270269    m_networkingContext = m_client.createNetworkingContext();
    271     m_progressTracker = FrameProgressTracker::create(m_frame);
     270    m_progressTracker = std::make_unique<FrameProgressTracker>(m_frame);
    272271}
    273272
     
    24152414    detachViewsAndDocumentLoader();
    24162415
    2417     m_progressTracker.clear();
     2416    m_progressTracker = nullptr;
    24182417
    24192418    if (Frame* parent = m_frame.tree().parent()) {
  • trunk/Source/WebCore/loader/FrameLoader.h

    r157007 r158958  
    383383    FrameLoaderClient& m_client;
    384384
    385     // FIXME: These should be OwnPtr<T> to reduce build times and simplify
    386     // header dependencies unless performance testing proves otherwise.
    387     // Some of these could be lazily created for memory savings on devices.
    388     const OwnPtr<PolicyChecker> m_policyChecker;
    389     const OwnPtr<HistoryController> m_history;
     385    const std::unique_ptr<PolicyChecker> m_policyChecker;
     386    const std::unique_ptr<HistoryController> m_history;
    390387    mutable ResourceLoadNotifier m_notifier;
    391     const OwnPtr<SubframeLoader> m_subframeLoader;
     388    const std::unique_ptr<SubframeLoader> m_subframeLoader;
    392389    mutable FrameLoaderStateMachine m_stateMachine;
    393     const OwnPtr<IconController> m_icon;
     390    const std::unique_ptr<IconController> m_icon;
    394391    mutable MixedContentChecker m_mixedContentChecker;
    395392
    396393    class FrameProgressTracker;
    397     OwnPtr<FrameProgressTracker> m_progressTracker;
     394    std::unique_ptr<FrameProgressTracker> m_progressTracker;
    398395
    399396    FrameState m_state;
  • trunk/Source/WebCore/loader/MixedContentChecker.cpp

    r156550 r158958  
    4444namespace WebCore {
    4545
    46 MixedContentChecker::MixedContentChecker(Frame* frame)
     46MixedContentChecker::MixedContentChecker(Frame& frame)
    4747    : m_frame(frame)
    4848{
     
    5151FrameLoaderClient& MixedContentChecker::client() const
    5252{
    53     return m_frame->loader().client();
     53    return m_frame.loader().client();
    5454}
    5555
     
    6969        return true;
    7070
    71     bool allowed = client().allowDisplayingInsecureContent(m_frame->settings().allowDisplayOfInsecureContent(), securityOrigin, url);
     71    bool allowed = client().allowDisplayingInsecureContent(m_frame.settings().allowDisplayOfInsecureContent(), securityOrigin, url);
    7272    logWarning(allowed, "displayed", url);
    7373
     
    8383        return true;
    8484
    85     bool allowed = client().allowRunningInsecureContent(m_frame->settings().allowRunningOfInsecureContent(), securityOrigin, url);
     85    bool allowed = client().allowRunningInsecureContent(m_frame.settings().allowRunningOfInsecureContent(), securityOrigin, url);
    8686    logWarning(allowed, "ran", url);
    8787
     
    9494void MixedContentChecker::logWarning(bool allowed, const String& action, const URL& target) const
    9595{
    96     String message = makeString((allowed ? "" : "[blocked] "), "The page at ", m_frame->document()->url().stringCenterEllipsizedToLength(), " ", action, " insecure content from ", target.stringCenterEllipsizedToLength(), ".\n");
    97     m_frame->document()->addConsoleMessage(SecurityMessageSource, WarningMessageLevel, message);
     96    String message = makeString((allowed ? "" : "[blocked] "), "The page at ", m_frame.document()->url().stringCenterEllipsizedToLength(), " ", action, " insecure content from ", target.stringCenterEllipsizedToLength(), ".\n");
     97    m_frame.document()->addConsoleMessage(SecurityMessageSource, WarningMessageLevel, message);
    9898}
    9999
  • trunk/Source/WebCore/loader/MixedContentChecker.h

    r156550 r158958  
    4545    WTF_MAKE_NONCOPYABLE(MixedContentChecker);
    4646public:
    47     MixedContentChecker(Frame*);
     47    MixedContentChecker(Frame&);
    4848
    4949    bool canDisplayInsecureContent(SecurityOrigin*, const URL&) const;
     
    5757    void logWarning(bool allowed, const String& action, const URL&) const;
    5858
    59     Frame* m_frame;
     59    Frame& m_frame;
    6060};
    6161
Note: See TracChangeset for help on using the changeset viewer.