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

Side by Side Diff: gfx/gtk_native_view_id_manager.h

Issue 5275009: Defer window destruction until GPU finished drawing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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 | Annotate | Revision Log
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // widget to create a window. 63 // widget to create a window.
64 // 64 //
65 // Keeping the XID permanent requires a bit of overhead, so it must 65 // Keeping the XID permanent requires a bit of overhead, so it must
66 // be explicitly requested. 66 // be explicitly requested.
67 // 67 //
68 // xid: (output) the resulting X window 68 // xid: (output) the resulting X window
69 // id: a value previously returned from GetIdForWidget 69 // id: a value previously returned from GetIdForWidget
70 // returns: true if |id| is a valid id, false otherwise. 70 // returns: true if |id| is a valid id, false otherwise.
71 bool GetPermanentXIDForId(XID* xid, gfx::NativeViewId id); 71 bool GetPermanentXIDForId(XID* xid, gfx::NativeViewId id);
72 72
73 // Must be called from the UI thread because we may need to access a
74 // GtkWidget or destroy a GdkWindow.
75 //
76 // If the widget associated with the XID is still alive, release the lock
piman 2010/11/29 21:59:01 You're talking about a lock here, but it's unclear
77 // on the XID associated with a widget. Otherwise, destroy the GdkWindow
78 // associated with the XID.
79 void ReleasePermanentXID(XID xid);
80
73 // These are actually private functions, but need to be called from statics. 81 // These are actually private functions, but need to be called from statics.
74 void OnRealize(gfx::NativeView widget); 82 void OnRealize(gfx::NativeView widget);
75 void OnUnrealize(gfx::NativeView widget); 83 void OnUnrealize(gfx::NativeView widget);
76 void OnDestroy(gfx::NativeView widget); 84 void OnDestroy(gfx::NativeView widget);
77 85
78 Lock& unrealize_lock() { return unrealize_lock_; } 86 Lock& unrealize_lock() { return unrealize_lock_; }
79 87
80 private: 88 private:
81 // This object is a singleton: 89 // This object is a singleton:
82 GtkNativeViewManager(); 90 GtkNativeViewManager();
(...skipping 15 matching lines...) Expand all
98 Lock unrealize_lock_; 106 Lock unrealize_lock_;
99 107
100 // protects native_view_to_id_ and id_to_info_ 108 // protects native_view_to_id_ and id_to_info_
101 Lock lock_; 109 Lock lock_;
102 110
103 // If asked for an id for the same widget twice, we want to return the same 111 // If asked for an id for the same widget twice, we want to return the same
104 // id. So this records the current mapping. 112 // id. So this records the current mapping.
105 std::map<gfx::NativeView, gfx::NativeViewId> native_view_to_id_; 113 std::map<gfx::NativeView, gfx::NativeViewId> native_view_to_id_;
106 std::map<gfx::NativeViewId, NativeViewInfo> id_to_info_; 114 std::map<gfx::NativeViewId, NativeViewInfo> id_to_info_;
107 115
116 // Mapping from X window to associated widget.
117 //
118 // In general, several GTK widgets may share the same X window. We assume
119 // that is not true of widgets in this registry.
120 //
121 // An XID will map to NULL, if the widget had been instructed to preserve
122 // it's X window, but was destroyed. In this case, the destruction is deferred
piman 2010/11/29 21:59:01 it's->its
jonathan.backer 2010/11/30 13:09:31 Done.
123 // until a call to ReleasePermXID.
piman 2010/11/29 21:59:01 ReleasePermXID -> ReleasePermanentXID
jonathan.backer 2010/11/30 13:09:31 Done.
124 std::map<XID, gfx::NativeView> xid_to_native_view_;
125
108 DISALLOW_COPY_AND_ASSIGN(GtkNativeViewManager); 126 DISALLOW_COPY_AND_ASSIGN(GtkNativeViewManager);
109 }; 127 };
110 128
111 #endif // GFX_GTK_NATIVE_VIEW_ID_MANAGER_H_ 129 #endif // GFX_GTK_NATIVE_VIEW_ID_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698