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

Side by Side Diff: gfx/gtk_native_view_id_manager.h

Issue 3522004: FBTF: Move ctors/dtors into implementation files. Adds ctors/dtors to non-POD structs. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 GFX_GTK_NATIVE_VIEW_ID_MANAGER_H_ 5 #ifndef GFX_GTK_NATIVE_VIEW_ID_MANAGER_H_
6 #define GFX_GTK_NATIVE_VIEW_ID_MANAGER_H_ 6 #define GFX_GTK_NATIVE_VIEW_ID_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // These are actually private functions, but need to be called from statics. 62 // These are actually private functions, but need to be called from statics.
63 void OnRealize(gfx::NativeView widget); 63 void OnRealize(gfx::NativeView widget);
64 void OnUnrealize(gfx::NativeView widget); 64 void OnUnrealize(gfx::NativeView widget);
65 void OnDestroy(gfx::NativeView widget); 65 void OnDestroy(gfx::NativeView widget);
66 66
67 Lock& unrealize_lock() { return unrealize_lock_; } 67 Lock& unrealize_lock() { return unrealize_lock_; }
68 68
69 private: 69 private:
70 // This object is a singleton: 70 // This object is a singleton:
71 GtkNativeViewManager(); 71 GtkNativeViewManager();
72 ~GtkNativeViewManager();
72 friend struct DefaultSingletonTraits<GtkNativeViewManager>; 73 friend struct DefaultSingletonTraits<GtkNativeViewManager>;
73 74
74 struct NativeViewInfo { 75 struct NativeViewInfo {
75 NativeViewInfo() 76 NativeViewInfo()
76 : x_window_id(0) { 77 : x_window_id(0) {
77 } 78 }
78 79
79 XID x_window_id; 80 XID x_window_id;
80 }; 81 };
81 82
82 gfx::NativeViewId GetWidgetId(gfx::NativeView id); 83 gfx::NativeViewId GetWidgetId(gfx::NativeView id);
83 84
84 // This lock can be used to block GTK from unrealizing windows. This is needed 85 // This lock can be used to block GTK from unrealizing windows. This is needed
85 // when the BACKGROUND_X11 thread is using a window obtained via GetXIDForId, 86 // when the BACKGROUND_X11 thread is using a window obtained via GetXIDForId,
86 // and can't allow the X11 resource to be deleted. 87 // and can't allow the X11 resource to be deleted.
87 Lock unrealize_lock_; 88 Lock unrealize_lock_;
88 89
89 // protects native_view_to_id_ and id_to_info_ 90 // protects native_view_to_id_ and id_to_info_
90 Lock lock_; 91 Lock lock_;
91 92
92 // If asked for an id for the same widget twice, we want to return the same 93 // If asked for an id for the same widget twice, we want to return the same
93 // id. So this records the current mapping. 94 // id. So this records the current mapping.
94 std::map<gfx::NativeView, gfx::NativeViewId> native_view_to_id_; 95 std::map<gfx::NativeView, gfx::NativeViewId> native_view_to_id_;
95 std::map<gfx::NativeViewId, NativeViewInfo> id_to_info_; 96 std::map<gfx::NativeViewId, NativeViewInfo> id_to_info_;
96 97
97 DISALLOW_COPY_AND_ASSIGN(GtkNativeViewManager); 98 DISALLOW_COPY_AND_ASSIGN(GtkNativeViewManager);
98 }; 99 };
99 100
100 #endif // GFX_GTK_NATIVE_VIEW_ID_MANAGER_H_ 101 #endif // GFX_GTK_NATIVE_VIEW_ID_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698