summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_annot.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-07 14:11:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-07 14:11:27 -0700
commit7b68f616e49235267eeac8db51aadade6d60e243 (patch)
treee49619edf4ff8f7b10adec869bb30dcc4a1b88f9 /fpdfsdk/cpdfsdk_annot.cpp
parentf56d93f8ea1c2145401e99e61cefdbfcb7341229 (diff)
downloadpdfium-7b68f616e49235267eeac8db51aadade6d60e243.tar.xz
Make Observers into a templated class
Review-Url: https://codereview.chromium.org/2311343003
Diffstat (limited to 'fpdfsdk/cpdfsdk_annot.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_annot.cpp31
1 files changed, 1 insertions, 30 deletions
diff --git a/fpdfsdk/cpdfsdk_annot.cpp b/fpdfsdk/cpdfsdk_annot.cpp
index 353edaaaf9..738508f984 100644
--- a/fpdfsdk/cpdfsdk_annot.cpp
+++ b/fpdfsdk/cpdfsdk_annot.cpp
@@ -22,39 +22,10 @@ const float kMinHeight = 1.0f;
} // namespace
-CPDFSDK_Annot::Observer::Observer(CPDFSDK_Annot** pWatchedPtr)
- : m_pWatchedPtr(pWatchedPtr) {
- (*m_pWatchedPtr)->AddObserver(this);
-}
-
-CPDFSDK_Annot::Observer::~Observer() {
- if (m_pWatchedPtr)
- (*m_pWatchedPtr)->RemoveObserver(this);
-}
-
-void CPDFSDK_Annot::Observer::OnAnnotDestroyed() {
- ASSERT(m_pWatchedPtr);
- *m_pWatchedPtr = nullptr;
- m_pWatchedPtr = nullptr;
-}
-
CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView)
: m_pPageView(pPageView), m_bSelected(FALSE) {}
-CPDFSDK_Annot::~CPDFSDK_Annot() {
- for (auto* pObserver : m_Observers)
- pObserver->OnAnnotDestroyed();
-}
-
-void CPDFSDK_Annot::AddObserver(Observer* pObserver) {
- ASSERT(!pdfium::ContainsKey(m_Observers, pObserver));
- m_Observers.insert(pObserver);
-}
-
-void CPDFSDK_Annot::RemoveObserver(Observer* pObserver) {
- ASSERT(pdfium::ContainsKey(m_Observers, pObserver));
- m_Observers.erase(pObserver);
-}
+CPDFSDK_Annot::~CPDFSDK_Annot() {}
#ifdef PDF_ENABLE_XFA