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

Side by Side Diff: content/public/renderer/render_frame_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 RenderFrameObservers for a given RenderFrame. 5 // Helper class used to find the RenderFrameObservers for a given RenderFrame.
6 // 6 //
7 // Example usage: 7 // Example usage:
8 // 8 //
9 // class MyRFO : public RenderFrameObserver, 9 // class MyRFO : public RenderFrameObserver,
10 // public RenderFrameObserverTracker<MyRFO> { 10 // public RenderFrameObserverTracker<MyRFO> {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 : render_frame_(render_frame) { 46 : render_frame_(render_frame) {
47 render_frame_map_.Get()[render_frame] = this; 47 render_frame_map_.Get()[render_frame] = this;
48 } 48 }
49 ~RenderFrameObserverTracker() { 49 ~RenderFrameObserverTracker() {
50 render_frame_map_.Get().erase(render_frame_); 50 render_frame_map_.Get().erase(render_frame_);
51 } 51 }
52 52
53 private: 53 private:
54 const RenderFrame* render_frame_; 54 const RenderFrame* render_frame_;
55 55
56 static base::LazyInstance< 56 static typename base::LazyInstance<
57 std::map<const RenderFrame*, RenderFrameObserverTracker<T>*>> 57 std::map<const RenderFrame*, RenderFrameObserverTracker<T>*>>::
58 render_frame_map_; 58 DestructorAtExit render_frame_map_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(RenderFrameObserverTracker<T>); 60 DISALLOW_COPY_AND_ASSIGN(RenderFrameObserverTracker<T>);
61 }; 61 };
62 62
63 template <class T> 63 template <class T>
64 base::LazyInstance<std::map<const RenderFrame*, 64 typename base::LazyInstance<
65 RenderFrameObserverTracker<T>*>> 65 std::map<const RenderFrame*, RenderFrameObserverTracker<T>*>>::
66 RenderFrameObserverTracker<T>::render_frame_map_ = 66 DestructorAtExit RenderFrameObserverTracker<T>::render_frame_map_ =
67 LAZY_INSTANCE_INITIALIZER; 67 LAZY_INSTANCE_INITIALIZER;
68 68
69 } // namespace content 69 } // namespace content
70 70
71 #endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_OBSERVER_TRACKER_H_ 71 #endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_OBSERVER_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698