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

Side by Side Diff: core/fxcrt/cfx_observable.h

Issue 2382723003: Move core/fxcrt/include to core/fxcrt (Closed)
Patch Set: Rebase to master Created 4 years, 2 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
« no previous file with comments | « core/fxcrt/cfx_count_ref_unittest.cpp ('k') | core/fxcrt/cfx_observable_unittest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CORE_FXCRT_INCLUDE_CFX_OBSERVABLE_H_ 5 #ifndef CORE_FXCRT_CFX_OBSERVABLE_H_
6 #define CORE_FXCRT_INCLUDE_CFX_OBSERVABLE_H_ 6 #define CORE_FXCRT_CFX_OBSERVABLE_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "core/fxcrt/include/fx_system.h" 10 #include "core/fxcrt/fx_system.h"
11 #include "third_party/base/stl_util.h" 11 #include "third_party/base/stl_util.h"
12 12
13 template <class T> 13 template <class T>
14 class CFX_Observable { 14 class CFX_Observable {
15 public: 15 public:
16 class ObservedPtr { 16 class ObservedPtr {
17 public: 17 public:
18 ObservedPtr() : m_pObservedPtr(nullptr) {} 18 ObservedPtr() : m_pObservedPtr(nullptr) {}
19 explicit ObservedPtr(T* pObservedPtr) : m_pObservedPtr(pObservedPtr) { 19 explicit ObservedPtr(T* pObservedPtr) : m_pObservedPtr(pObservedPtr) {
20 if (m_pObservedPtr) 20 if (m_pObservedPtr)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 CFX_Observable& operator=(const CFX_Observable& that) = delete; 69 CFX_Observable& operator=(const CFX_Observable& that) = delete;
70 70
71 protected: 71 protected:
72 size_t ActiveObservedPtrsForTesting() const { return m_ObservedPtrs.size(); } 72 size_t ActiveObservedPtrsForTesting() const { return m_ObservedPtrs.size(); }
73 73
74 private: 74 private:
75 std::set<ObservedPtr*> m_ObservedPtrs; 75 std::set<ObservedPtr*> m_ObservedPtrs;
76 }; 76 };
77 77
78 #endif // CORE_FXCRT_INCLUDE_CFX_OBSERVABLE_H_ 78 #endif // CORE_FXCRT_CFX_OBSERVABLE_H_
OLDNEW
« no previous file with comments | « core/fxcrt/cfx_count_ref_unittest.cpp ('k') | core/fxcrt/cfx_observable_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698