Remove CFWL_NoteLoop and associated code. All of this code is no longer used after commit a96e2eb6. BUG=chromium:976429 Change-Id: I4b4056234a6b50aa3ec0ec2f9965a661a7d769c9 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/56510 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fwl/BUILD.gn b/xfa/fwl/BUILD.gn index 1ac7472..064a4eb 100644 --- a/xfa/fwl/BUILD.gn +++ b/xfa/fwl/BUILD.gn
@@ -64,8 +64,6 @@ "cfwl_monthcalendar.h", "cfwl_notedriver.cpp", "cfwl_notedriver.h", - "cfwl_noteloop.cpp", - "cfwl_noteloop.h", "cfwl_picturebox.cpp", "cfwl_picturebox.h", "cfwl_pushbutton.cpp",
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp index 4943957..190a6d4 100644 --- a/xfa/fwl/cfwl_notedriver.cpp +++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -20,13 +20,10 @@ #include "xfa/fwl/cfwl_messagemouse.h" #include "xfa/fwl/cfwl_messagemousewheel.h" #include "xfa/fwl/cfwl_messagesetfocus.h" -#include "xfa/fwl/cfwl_noteloop.h" #include "xfa/fwl/cfwl_widgetmgr.h" #include "xfa/fwl/fwl_widgetdef.h" -CFWL_NoteDriver::CFWL_NoteDriver() - : m_pNoteLoop(pdfium::MakeUnique<CFWL_NoteLoop>()) { -} +CFWL_NoteDriver::CFWL_NoteDriver() = default; CFWL_NoteDriver::~CFWL_NoteDriver() = default; @@ -83,17 +80,6 @@ return true; } -void CFWL_NoteDriver::Run() { -#if defined(OS_LINUX) || defined(OS_WIN) - for (;;) { - CFWL_NoteLoop* pTopLoop = GetTopLoop(); - if (!pTopLoop || !pTopLoop->ContinueModal()) - break; - UnqueueMessageAndProcess(pTopLoop); - } -#endif // defined(OS_LINUX) || defined(OS_WIN) -} - void CFWL_NoteDriver::NotifyTargetHide(CFWL_Widget* pNoteTarget) { if (m_pFocus == pNoteTarget) m_pFocus = nullptr; @@ -114,22 +100,6 @@ UnregisterEventTarget(pNoteTarget); } -void CFWL_NoteDriver::QueueMessage(std::unique_ptr<CFWL_Message> pMessage) { - m_NoteQueue.push_back(std::move(pMessage)); -} - -void CFWL_NoteDriver::UnqueueMessageAndProcess(CFWL_NoteLoop* pNoteLoop) { - if (m_NoteQueue.empty()) - return; - - std::unique_ptr<CFWL_Message> pMessage = std::move(m_NoteQueue.front()); - m_NoteQueue.pop_front(); - if (!IsValidMessage(pMessage.get())) - return; - - ProcessMessage(std::move(pMessage)); -} - void CFWL_NoteDriver::ProcessMessage(std::unique_ptr<CFWL_Message> pMessage) { CFWL_Widget* pMessageForm = pMessage->GetDstTarget(); if (!pMessageForm) @@ -307,18 +277,12 @@ DispatchMessage(&msHover, nullptr); } -bool CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { - CFWL_Widget* pForm = m_pNoteLoop->GetForm(); - return pForm && pForm == pMessage->GetDstTarget(); -} - CFWL_Widget* CFWL_NoteDriver::GetMessageForm(CFWL_Widget* pDstTarget) { - CFWL_Widget* pMessageForm = m_pNoteLoop->GetForm(); - if (!pMessageForm && pDstTarget) { - CFWL_WidgetMgr* pWidgetMgr = pDstTarget->GetOwnerApp()->GetWidgetMgr(); - pMessageForm = pWidgetMgr->GetSystemFormWidget(pDstTarget); - } - return pMessageForm; + if (!pDstTarget) + return nullptr; + + CFWL_WidgetMgr* pWidgetMgr = pDstTarget->GetOwnerApp()->GetWidgetMgr(); + return pWidgetMgr->GetSystemFormWidget(pDstTarget); } void CFWL_NoteDriver::ClearEventTargets() {
diff --git a/xfa/fwl/cfwl_notedriver.h b/xfa/fwl/cfwl_notedriver.h index f15fef7..1de761b 100644 --- a/xfa/fwl/cfwl_notedriver.h +++ b/xfa/fwl/cfwl_notedriver.h
@@ -7,7 +7,6 @@ #ifndef XFA_FWL_CFWL_NOTEDRIVER_H_ #define XFA_FWL_CFWL_NOTEDRIVER_H_ -#include <deque> #include <map> #include <memory> #include <vector> @@ -18,7 +17,6 @@ #include "xfa/fxgraphics/cxfa_graphics.h" class CFWL_EventTarget; -class CFWL_NoteLoop; class CFWL_TargetImp; class CFWL_Widget; @@ -33,19 +31,15 @@ void UnregisterEventTarget(CFWL_Widget* pListener); void ClearEventTargets(); - CFWL_NoteLoop* GetTopLoop() const { return m_pNoteLoop.get(); } CFWL_Widget* GetFocus() const { return m_pFocus.Get(); } bool SetFocus(CFWL_Widget* pFocus); void SetGrab(CFWL_Widget* pGrab, bool bSet) { m_pGrab = bSet ? pGrab : nullptr; } - void Run(); void NotifyTargetHide(CFWL_Widget* pNoteTarget); void NotifyTargetDestroy(CFWL_Widget* pNoteTarget); void ProcessMessage(std::unique_ptr<CFWL_Message> pMessage); - void QueueMessage(std::unique_ptr<CFWL_Message> pMessage); - void UnqueueMessageAndProcess(CFWL_NoteLoop* pNoteLoop); private: bool DispatchMessage(CFWL_Message* pMessage, CFWL_Widget* pMessageForm); @@ -56,11 +50,8 @@ bool DoWheel(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); bool DoMouseEx(CFWL_Message* pMsg, CFWL_Widget* pMessageForm); void MouseSecondary(CFWL_Message* pMsg); - bool IsValidMessage(CFWL_Message* pMessage); CFWL_Widget* GetMessageForm(CFWL_Widget* pDstTarget); - std::deque<std::unique_ptr<CFWL_Message>> m_NoteQueue; - std::unique_ptr<CFWL_NoteLoop> const m_pNoteLoop; std::map<uint32_t, std::unique_ptr<CFWL_EventTarget>> m_eventTargets; UnownedPtr<CFWL_Widget> m_pHover; UnownedPtr<CFWL_Widget> m_pFocus;
diff --git a/xfa/fwl/cfwl_noteloop.cpp b/xfa/fwl/cfwl_noteloop.cpp deleted file mode 100644 index ff35a1a..0000000 --- a/xfa/fwl/cfwl_noteloop.cpp +++ /dev/null
@@ -1,9 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fwl/cfwl_noteloop.h" - -CFWL_NoteLoop::CFWL_NoteLoop() : m_bContinueModal(true) {}
diff --git a/xfa/fwl/cfwl_noteloop.h b/xfa/fwl/cfwl_noteloop.h deleted file mode 100644 index 57e1a14..0000000 --- a/xfa/fwl/cfwl_noteloop.h +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CFWL_NOTELOOP_H_ -#define XFA_FWL_CFWL_NOTELOOP_H_ - -class CFWL_Widget; - -class CFWL_NoteLoop { - public: - CFWL_NoteLoop(); - ~CFWL_NoteLoop() {} - - CFWL_Widget* GetForm() const { return m_pForm; } - bool ContinueModal() const { return m_bContinueModal; } - void EndModalLoop() { m_bContinueModal = false; } - void SetMainForm(CFWL_Widget* pForm) { m_pForm = pForm; } - - private: - CFWL_Widget* m_pForm; - bool m_bContinueModal; -}; - -#endif // XFA_FWL_CFWL_NOTELOOP_H_
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp index a95386f..ba3c368 100644 --- a/xfa/fwl/cfwl_widgetmgr.cpp +++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -323,12 +323,6 @@ CFWL_NoteDriver* pNoteDriver = pDstWidget->GetOwnerApp()->GetNoteDriver(); pNoteDriver->ProcessMessage(pMessage->Clone()); - -#if defined(OS_MACOSX) - CFWL_NoteLoop* pTopLoop = pNoteDriver->GetTopLoop(); - if (pTopLoop) - pNoteDriver->UnqueueMessageAndProcess(pTopLoop); -#endif } void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget,