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

Side by Side Diff: content/public/renderer/render_view_observer_tracker.h

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: Created 3 years, 9 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 (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 // Helper class used to find the RenderViewObservers for a given RenderView. 5 // Helper class used to find the RenderViewObservers for a given RenderView.
6 // 6 //
7 // Example usage: 7 // Example usage:
8 // 8 //
9 // class MyRVO : public RenderViewObserver, 9 // class MyRVO : public RenderViewObserver,
10 // public RenderViewObserverTracker<MyRVO> { 10 // public RenderViewObserverTracker<MyRVO> {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 : render_view_(render_view) { 46 : render_view_(render_view) {
47 render_view_map_.Get()[render_view] = this; 47 render_view_map_.Get()[render_view] = this;
48 } 48 }
49 ~RenderViewObserverTracker() { 49 ~RenderViewObserverTracker() {
50 render_view_map_.Get().erase(render_view_); 50 render_view_map_.Get().erase(render_view_);
51 } 51 }
52 52
53 private: 53 private:
54 const RenderView* render_view_; 54 const RenderView* render_view_;
55 55
56 static base::LazyInstance< 56 static typename base::LazyInstance<
57 std::map<const RenderView*, RenderViewObserverTracker<T>*>> 57 std::map<const RenderView*, RenderViewObserverTracker<T>*>>::
58 render_view_map_; 58 DestructorAtExit render_view_map_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(RenderViewObserverTracker<T>); 60 DISALLOW_COPY_AND_ASSIGN(RenderViewObserverTracker<T>);
61 }; 61 };
62 62
63 template <class T> 63 template <class T>
64 base::LazyInstance<std::map<const RenderView*, RenderViewObserverTracker<T>*>> 64 typename base::LazyInstance<
65 RenderViewObserverTracker<T>::render_view_map_ = LAZY_INSTANCE_INITIALIZER; 65 std::map<const RenderView*, RenderViewObserverTracker<T>*>>::
66 DestructorAtExit RenderViewObserverTracker<T>::render_view_map_ =
67 LAZY_INSTANCE_INITIALIZER;
66 68
67 } // namespace content 69 } // namespace content
68 70
69 #endif // CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_TRACKER_H_ 71 #endif // CONTENT_PUBLIC_RENDERER_RENDER_VIEW_OBSERVER_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698