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

Side by Side Diff: xfa/fwl/core/fwl_noteimp.cpp

Issue 2207093005: Use smart pointers for class owned pointers (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: small fix Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fwl/core/fwl_noteimp.h" 7 #include "xfa/fwl/core/fwl_noteimp.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "third_party/base/stl_util.h" 10 #include "third_party/base/stl_util.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 if (!pDriver) 63 if (!pDriver)
64 return; 64 return;
65 65
66 pDriver->SendEvent(&ev); 66 pDriver->SendEvent(&ev);
67 } 67 }
68 CFWL_NoteDriver::CFWL_NoteDriver() 68 CFWL_NoteDriver::CFWL_NoteDriver()
69 : m_pHover(nullptr), 69 : m_pHover(nullptr),
70 m_pFocus(nullptr), 70 m_pFocus(nullptr),
71 m_pGrab(nullptr), 71 m_pGrab(nullptr),
72 m_pNoteLoop(new CFWL_NoteLoop) { 72 m_pNoteLoop(new CFWL_NoteLoop) {
73 PushNoteLoop(m_pNoteLoop); 73 PushNoteLoop(m_pNoteLoop.get());
74 } 74 }
75 CFWL_NoteDriver::~CFWL_NoteDriver() { 75 CFWL_NoteDriver::~CFWL_NoteDriver() {
76 delete m_pNoteLoop;
77 ClearInvalidEventTargets(TRUE); 76 ClearInvalidEventTargets(TRUE);
78 } 77 }
79 78
80 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { 79 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) {
81 if (m_eventTargets.empty()) 80 if (m_eventTargets.empty())
82 return; 81 return;
83 82
84 for (const auto& pair : m_eventTargets) { 83 for (const auto& pair : m_eventTargets) {
85 CFWL_EventTarget* pEventTarget = pair.second; 84 CFWL_EventTarget* pEventTarget = pair.second;
86 if (pEventTarget && !pEventTarget->IsInvalid()) 85 if (pEventTarget && !pEventTarget->IsInvalid())
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); 765 return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK);
767 case CFWL_EventType::Idle: 766 case CFWL_EventType::Idle:
768 return !!(dwFilter & FWL_EVENT_IDLE_MASK); 767 return !!(dwFilter & FWL_EVENT_IDLE_MASK);
769 default: 768 default:
770 return !!(dwFilter & FWL_EVENT_CONTROL_MASK); 769 return !!(dwFilter & FWL_EVENT_CONTROL_MASK);
771 } 770 }
772 } 771 }
773 772
774 CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr; 773 CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr;
775 774
776 CFWL_ToolTipContainer::CFWL_ToolTipContainer() : m_pToolTipImp(nullptr) { 775 CFWL_ToolTipContainer::CFWL_ToolTipContainer()
777 m_ToolTipDp = new CFWL_CoreToolTipDP; 776 : m_pToolTipImp(nullptr), m_pToolTipDp(new CFWL_CoreToolTipDP) {
778 m_ToolTipDp->m_nInitDelayTime = 0; 777 m_pToolTipDp->m_nInitDelayTime = 0;
Lei Zhang 2016/08/04 18:49:31 Pass these into the CFWL_CoreToolTipDP ctor? The v
Wei Li 2016/08/04 22:16:04 Done.
779 m_ToolTipDp->m_nAutoPopDelayTime = 2000; 778 m_pToolTipDp->m_nAutoPopDelayTime = 2000;
780 } 779 }
780
781 CFWL_ToolTipContainer::~CFWL_ToolTipContainer() { 781 CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {
782 if (m_pToolTipImp) { 782 if (m_pToolTipImp) {
783 IFWL_ToolTip* pToolTip = 783 IFWL_ToolTip* pToolTip =
784 static_cast<IFWL_ToolTip*>(m_pToolTipImp->GetInterface()); 784 static_cast<IFWL_ToolTip*>(m_pToolTipImp->GetInterface());
785 pToolTip->Finalize(); 785 pToolTip->Finalize();
786 delete pToolTip; 786 delete pToolTip;
787 } 787 }
788 delete m_ToolTipDp;
789 } 788 }
790 789
791 // static 790 // static
792 CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() { 791 CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() {
793 if (!s_pInstance) 792 if (!s_pInstance)
794 s_pInstance = new CFWL_ToolTipContainer; 793 s_pInstance = new CFWL_ToolTipContainer;
795 return s_pInstance; 794 return s_pInstance;
796 } 795 }
797 796
798 // static 797 // static
799 void CFWL_ToolTipContainer::DeleteInstance() { 798 void CFWL_ToolTipContainer::DeleteInstance() {
800 delete s_pInstance; 799 delete s_pInstance;
801 s_pInstance = nullptr; 800 s_pInstance = nullptr;
802 } 801 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698