Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Unified Diff: Source/core/page/FocusController.cpp

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Back out non-Oilpan experiment + tidy up by adding frame() ref accessors Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/page/FocusController.cpp
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp
index d6c0a8db6569049651cef9ea37e7a19bf8d8c7a1..f9cb3d95a7062afb608644e7ab992efb0939656f 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -40,8 +40,8 @@
#include "core/editing/FrameSelection.h"
#include "core/editing/htmlediting.h" // For firstPositionInOrBeforeNode
#include "core/events/Event.h"
-#include "core/frame/LocalDOMWindow.h"
#include "core/frame/FrameView.h"
+#include "core/frame/LocalDOMWindow.h"
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLAreaElement.h"
#include "core/html/HTMLImageElement.h"
@@ -229,12 +229,12 @@ FocusController::FocusController(Page* page)
{
}
-PassOwnPtr<FocusController> FocusController::create(Page* page)
+PassOwnPtrWillBeRawPtr<FocusController> FocusController::create(Page* page)
{
- return adoptPtr(new FocusController(page));
+ return adoptPtrWillBeNoop(new FocusController(page));
}
-void FocusController::setFocusedFrame(PassRefPtr<Frame> frame)
+void FocusController::setFocusedFrame(PassRefPtrWillBeRawPtr<Frame> frame)
{
ASSERT(!frame || frame->page() == m_page);
if (m_focusedFrame == frame || m_isChangingFocusedFrame)
@@ -242,8 +242,9 @@ void FocusController::setFocusedFrame(PassRefPtr<Frame> frame)
m_isChangingFocusedFrame = true;
- RefPtr<LocalFrame> oldFrame = (m_focusedFrame && m_focusedFrame->isLocalFrame()) ? toLocalFrame(m_focusedFrame.get()) : 0;
- RefPtr<LocalFrame> newFrame = (frame && frame->isLocalFrame()) ? toLocalFrame(frame.get()) : 0;
+ RefPtrWillBeRawPtr<LocalFrame> oldFrame = (m_focusedFrame && m_focusedFrame->isLocalFrame()) ? toLocalFrame(m_focusedFrame.get()) : 0;
+
+ RefPtrWillBeRawPtr<LocalFrame> newFrame = (frame && frame->isLocalFrame()) ? toLocalFrame(frame.get()) : 0;
m_focusedFrame = frame.get();
@@ -263,13 +264,13 @@ void FocusController::setFocusedFrame(PassRefPtr<Frame> frame)
m_page->chrome().client().focusedFrameChanged(newFrame.get());
}
-void FocusController::focusDocumentView(PassRefPtr<Frame> frame)
+void FocusController::focusDocumentView(PassRefPtrWillBeRawPtr<Frame> frame)
{
ASSERT(!frame || frame->page() == m_page);
if (m_focusedFrame == frame)
return;
- RefPtr<LocalFrame> focusedFrame = (m_focusedFrame && m_focusedFrame->isLocalFrame()) ? toLocalFrame(m_focusedFrame.get()) : 0;
+ RefPtrWillBeRawPtr<LocalFrame> focusedFrame = (m_focusedFrame && m_focusedFrame->isLocalFrame()) ? toLocalFrame(m_focusedFrame.get()) : 0;
if (focusedFrame && focusedFrame->view()) {
RefPtrWillBeRawPtr<Document> document = focusedFrame->document();
Element* focusedElement = document ? document->focusedElement() : 0;
@@ -283,7 +284,7 @@ void FocusController::focusDocumentView(PassRefPtr<Frame> frame)
}
}
- RefPtr<LocalFrame> newFocusedFrame = (frame && frame->isLocalFrame()) ? toLocalFrame(frame.get()) : 0;
+ RefPtrWillBeRawPtr<LocalFrame> newFocusedFrame = (frame && frame->isLocalFrame()) ? toLocalFrame(frame.get()) : 0;
if (newFocusedFrame && newFocusedFrame->view()) {
RefPtrWillBeRawPtr<Document> document = newFocusedFrame->document();
Element* focusedElement = document ? document->focusedElement() : 0;
@@ -673,9 +674,9 @@ static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame, LocalFrame* newF
selection.clear();
}
-bool FocusController::setFocusedElement(Element* element, PassRefPtr<Frame> newFocusedFrame, FocusType type)
+bool FocusController::setFocusedElement(Element* element, PassRefPtrWillBeRawPtr<Frame> newFocusedFrame, FocusType type)
{
- RefPtr<LocalFrame> oldFocusedFrame = toLocalFrame(focusedFrame());
+ RefPtrWillBeRawPtr<LocalFrame> oldFocusedFrame = toLocalFrame(focusedFrame());
RefPtrWillBeRawPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame->document() : 0;
Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : 0;
@@ -924,4 +925,10 @@ bool FocusController::advanceFocusDirectionally(FocusType type)
return consumed;
}
+void FocusController::trace(Visitor* visitor)
+{
+ visitor->trace(m_page);
+ visitor->trace(m_focusedFrame);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698