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

Side by Side Diff: base/scoped_observer.h

Issue 1538743002: Switch to standard integer types in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DEPS roll too Created 4 years, 12 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 | « base/scoped_native_library_unittest.cc ('k') | base/security_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 BASE_SCOPED_OBSERVER_H_ 5 #ifndef BASE_SCOPED_OBSERVER_H_
6 #define BASE_SCOPED_OBSERVER_H_ 6 #define BASE_SCOPED_OBSERVER_H_
7 7
8 #include <stddef.h>
9
8 #include <algorithm> 10 #include <algorithm>
9 #include <vector> 11 #include <vector>
10 12
11 #include "base/basictypes.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h"
13 #include "base/stl_util.h" 15 #include "base/stl_util.h"
14 16
15 // ScopedObserver is used to keep track of the set of sources an object has 17 // ScopedObserver is used to keep track of the set of sources an object has
16 // attached itself to as an observer. When ScopedObserver is destroyed it 18 // attached itself to as an observer. When ScopedObserver is destroyed it
17 // removes the object as an observer from all sources it has been added to. 19 // removes the object as an observer from all sources it has been added to.
18 template <class Source, class Observer> 20 template <class Source, class Observer>
19 class ScopedObserver { 21 class ScopedObserver {
20 public: 22 public:
21 explicit ScopedObserver(Observer* observer) : observer_(observer) {} 23 explicit ScopedObserver(Observer* observer) : observer_(observer) {}
22 24
(...skipping 29 matching lines...) Expand all
52 54
53 private: 55 private:
54 Observer* observer_; 56 Observer* observer_;
55 57
56 std::vector<Source*> sources_; 58 std::vector<Source*> sources_;
57 59
58 DISALLOW_COPY_AND_ASSIGN(ScopedObserver); 60 DISALLOW_COPY_AND_ASSIGN(ScopedObserver);
59 }; 61 };
60 62
61 #endif // BASE_SCOPED_OBSERVER_H_ 63 #endif // BASE_SCOPED_OBSERVER_H_
OLDNEW
« no previous file with comments | « base/scoped_native_library_unittest.cc ('k') | base/security_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698