Diff
Modified: trunk/Source/WebCore/ChangeLog (158957 => 158958)
--- trunk/Source/WebCore/ChangeLog 2013-11-08 22:11:21 UTC (rev 158957)
+++ trunk/Source/WebCore/ChangeLog 2013-11-08 22:42:27 UTC (rev 158958)
@@ -1,3 +1,18 @@
+2013-11-08 Sam Weinig <[email protected]>
+
+ 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*.
+
2013-11-08 Zan Dobersek <[email protected]>
Remove code guarded with ENABLE(STREAM)
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (158957 => 158958)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2013-11-08 22:11:21 UTC (rev 158957)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2013-11-08 22:42:27 UTC (rev 158958)
@@ -176,7 +176,12 @@
class FrameLoader::FrameProgressTracker {
public:
- static PassOwnPtr<FrameProgressTracker> create(Frame& frame) { return adoptPtr(new FrameProgressTracker(frame)); }
+ explicit FrameProgressTracker(Frame& frame)
+ : m_frame(frame)
+ , m_inProgress(false)
+ {
+ }
+
~FrameProgressTracker()
{
ASSERT(!m_inProgress || m_frame.page());
@@ -201,12 +206,6 @@
}
private:
- FrameProgressTracker(Frame& frame)
- : m_frame(frame)
- , m_inProgress(false)
- {
- }
-
Frame& m_frame;
bool m_inProgress;
};
@@ -214,12 +213,12 @@
FrameLoader::FrameLoader(Frame& frame, FrameLoaderClient& client)
: m_frame(frame)
, m_client(client)
- , m_policyChecker(adoptPtr(new PolicyChecker(frame)))
- , m_history(adoptPtr(new HistoryController(frame)))
+ , m_policyChecker(std::make_unique<PolicyChecker>(frame))
+ , m_history(std::make_unique<HistoryController>(frame))
, m_notifier(frame)
- , m_subframeLoader(adoptPtr(new SubframeLoader(frame)))
- , m_icon(adoptPtr(new IconController(frame)))
- , m_mixedContentChecker(&frame)
+ , m_subframeLoader(std::make_unique<SubframeLoader>(frame))
+ , m_icon(std::make_unique<IconController>(frame))
+ , m_mixedContentChecker(frame)
, m_state(FrameStateProvisional)
, m_loadType(FrameLoadTypeStandard)
, m_delegateIsHandlingProvisionalLoadError(false)
@@ -235,7 +234,7 @@
, m_checkTimer(this, &FrameLoader::checkTimerFired)
, m_shouldCallCheckCompleted(false)
, m_shouldCallCheckLoadComplete(false)
- , m_opener(0)
+ , m_opener(nullptr)
, m_didPerformFirstNavigation(false)
, m_loadingFromCachedPage(false)
, m_suppressOpenerInNewFrame(false)
@@ -246,7 +245,7 @@
FrameLoader::~FrameLoader()
{
- setOpener(0);
+ setOpener(nullptr);
HashSet<Frame*>::iterator end = m_openedFrames.end();
for (HashSet<Frame*>::iterator it = m_openedFrames.begin(); it != end; ++it)
@@ -268,7 +267,7 @@
m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocument);
m_networkingContext = m_client.createNetworkingContext();
- m_progressTracker = FrameProgressTracker::create(m_frame);
+ m_progressTracker = std::make_unique<FrameProgressTracker>(m_frame);
}
void FrameLoader::setDefersLoading(bool defers)
@@ -2414,7 +2413,7 @@
detachViewsAndDocumentLoader();
- m_progressTracker.clear();
+ m_progressTracker = nullptr;
if (Frame* parent = m_frame.tree().parent()) {
parent->loader().closeAndRemoveChild(&m_frame);
Modified: trunk/Source/WebCore/loader/FrameLoader.h (158957 => 158958)
--- trunk/Source/WebCore/loader/FrameLoader.h 2013-11-08 22:11:21 UTC (rev 158957)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2013-11-08 22:42:27 UTC (rev 158958)
@@ -382,19 +382,16 @@
Frame& m_frame;
FrameLoaderClient& m_client;
- // FIXME: These should be OwnPtr<T> to reduce build times and simplify
- // header dependencies unless performance testing proves otherwise.
- // Some of these could be lazily created for memory savings on devices.
- const OwnPtr<PolicyChecker> m_policyChecker;
- const OwnPtr<HistoryController> m_history;
+ const std::unique_ptr<PolicyChecker> m_policyChecker;
+ const std::unique_ptr<HistoryController> m_history;
mutable ResourceLoadNotifier m_notifier;
- const OwnPtr<SubframeLoader> m_subframeLoader;
+ const std::unique_ptr<SubframeLoader> m_subframeLoader;
mutable FrameLoaderStateMachine m_stateMachine;
- const OwnPtr<IconController> m_icon;
+ const std::unique_ptr<IconController> m_icon;
mutable MixedContentChecker m_mixedContentChecker;
class FrameProgressTracker;
- OwnPtr<FrameProgressTracker> m_progressTracker;
+ std::unique_ptr<FrameProgressTracker> m_progressTracker;
FrameState m_state;
FrameLoadType m_loadType;
Modified: trunk/Source/WebCore/loader/MixedContentChecker.cpp (158957 => 158958)
--- trunk/Source/WebCore/loader/MixedContentChecker.cpp 2013-11-08 22:11:21 UTC (rev 158957)
+++ trunk/Source/WebCore/loader/MixedContentChecker.cpp 2013-11-08 22:42:27 UTC (rev 158958)
@@ -43,14 +43,14 @@
namespace WebCore {
-MixedContentChecker::MixedContentChecker(Frame* frame)
+MixedContentChecker::MixedContentChecker(Frame& frame)
: m_frame(frame)
{
}
FrameLoaderClient& MixedContentChecker::client() const
{
- return m_frame->loader().client();
+ return m_frame.loader().client();
}
// static
@@ -68,7 +68,7 @@
if (!isMixedContent(securityOrigin, url))
return true;
- bool allowed = client().allowDisplayingInsecureContent(m_frame->settings().allowDisplayOfInsecureContent(), securityOrigin, url);
+ bool allowed = client().allowDisplayingInsecureContent(m_frame.settings().allowDisplayOfInsecureContent(), securityOrigin, url);
logWarning(allowed, "displayed", url);
if (allowed)
@@ -82,7 +82,7 @@
if (!isMixedContent(securityOrigin, url))
return true;
- bool allowed = client().allowRunningInsecureContent(m_frame->settings().allowRunningOfInsecureContent(), securityOrigin, url);
+ bool allowed = client().allowRunningInsecureContent(m_frame.settings().allowRunningOfInsecureContent(), securityOrigin, url);
logWarning(allowed, "ran", url);
if (allowed)
@@ -93,8 +93,8 @@
void MixedContentChecker::logWarning(bool allowed, const String& action, const URL& target) const
{
- String message = makeString((allowed ? "" : "[blocked] "), "The page at ", m_frame->document()->url().stringCenterEllipsizedToLength(), " ", action, " insecure content from ", target.stringCenterEllipsizedToLength(), ".\n");
- m_frame->document()->addConsoleMessage(SecurityMessageSource, WarningMessageLevel, message);
+ String message = makeString((allowed ? "" : "[blocked] "), "The page at ", m_frame.document()->url().stringCenterEllipsizedToLength(), " ", action, " insecure content from ", target.stringCenterEllipsizedToLength(), ".\n");
+ m_frame.document()->addConsoleMessage(SecurityMessageSource, WarningMessageLevel, message);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/MixedContentChecker.h (158957 => 158958)
--- trunk/Source/WebCore/loader/MixedContentChecker.h 2013-11-08 22:11:21 UTC (rev 158957)
+++ trunk/Source/WebCore/loader/MixedContentChecker.h 2013-11-08 22:42:27 UTC (rev 158958)
@@ -44,7 +44,7 @@
class MixedContentChecker {
WTF_MAKE_NONCOPYABLE(MixedContentChecker);
public:
- MixedContentChecker(Frame*);
+ MixedContentChecker(Frame&);
bool canDisplayInsecureContent(SecurityOrigin*, const URL&) const;
bool canRunInsecureContent(SecurityOrigin*, const URL&) const;
@@ -56,7 +56,7 @@
void logWarning(bool allowed, const String& action, const URL&) const;
- Frame* m_frame;
+ Frame& m_frame;
};
} // namespace WebCore