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

Unified Diff: gfx/gtk_native_view_id_manager.h

Issue 2860024: GTK: add more syncronization to GtkNativeViewIdManager to avoid a crash. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: lock acquisition order Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter_gtk.cc ('k') | gfx/gtk_native_view_id_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gfx/gtk_native_view_id_manager.h
diff --git a/gfx/gtk_native_view_id_manager.h b/gfx/gtk_native_view_id_manager.h
index 048cd2d43f226ffd6be1bca45e4a7f00fc8dcf63..3a2394249ba393d294fd74b002c1b55a6f183cd0 100644
--- a/gfx/gtk_native_view_id_manager.h
+++ b/gfx/gtk_native_view_id_manager.h
@@ -63,6 +63,8 @@ class GtkNativeViewManager {
void OnUnrealize(gfx::NativeView widget);
void OnDestroy(gfx::NativeView widget);
+ Lock& unrealize_lock() { return unrealize_lock_; }
+
private:
// This object is a singleton:
GtkNativeViewManager();
@@ -78,12 +80,18 @@ class GtkNativeViewManager {
gfx::NativeViewId GetWidgetId(gfx::NativeView id);
+ // This lock can be used to block GTK from unrealizing windows. This is needed
+ // when the BACKGROUND_X11 thread is using a window obtained via GetXIDForId,
+ // and can't allow the X11 resource to be deleted.
+ Lock unrealize_lock_;
+
// protects native_view_to_id_ and id_to_info_
Lock lock_;
- // If asked for an id for the same widget twice, we want to return the same
- // id. So this records the current mapping.
- std::map<gfx::NativeView, gfx::NativeViewId> native_view_to_id_;
- std::map<gfx::NativeViewId, NativeViewInfo> id_to_info_;
+
+ // If asked for an id for the same widget twice, we want to return the same
+ // id. So this records the current mapping.
+ std::map<gfx::NativeView, gfx::NativeViewId> native_view_to_id_;
+ std::map<gfx::NativeViewId, NativeViewInfo> id_to_info_;
DISALLOW_COPY_AND_ASSIGN(GtkNativeViewManager);
};
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter_gtk.cc ('k') | gfx/gtk_native_view_id_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698