Chromium Code Reviews

Side by Side Diff: gfx/gtk_native_view_id_manager.cc

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.
Jump to:
View unified diff |
« no previous file with comments | « gfx/gtk_native_view_id_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "gfx/gtk_native_view_id_manager.h" 5 #include "gfx/gtk_native_view_id_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "gfx/rect.h" 9 #include "gfx/rect.h"
10 10
(...skipping 98 matching lines...)
109 std::map<gfx::NativeViewId, NativeViewInfo>::iterator i = 109 std::map<gfx::NativeViewId, NativeViewInfo>::iterator i =
110 id_to_info_.find(id); 110 id_to_info_.find(id);
111 111
112 CHECK(i != id_to_info_.end()); 112 CHECK(i != id_to_info_.end());
113 CHECK(widget->window); 113 CHECK(widget->window);
114 114
115 i->second.x_window_id = GDK_WINDOW_XID(widget->window); 115 i->second.x_window_id = GDK_WINDOW_XID(widget->window);
116 } 116 }
117 117
118 void GtkNativeViewManager::OnUnrealize(gfx::NativeView widget) { 118 void GtkNativeViewManager::OnUnrealize(gfx::NativeView widget) {
119 AutoLock unrealize_locked(unrealize_lock_);
119 AutoLock locked(lock_); 120 AutoLock locked(lock_);
120 121
121 const gfx::NativeViewId id = GetWidgetId(widget); 122 const gfx::NativeViewId id = GetWidgetId(widget);
122 std::map<gfx::NativeViewId, NativeViewInfo>::iterator i = 123 std::map<gfx::NativeViewId, NativeViewInfo>::iterator i =
123 id_to_info_.find(id); 124 id_to_info_.find(id);
124 125
125 CHECK(i != id_to_info_.end()); 126 CHECK(i != id_to_info_.end());
126 127
127 i->second.x_window_id = 0; 128 i->second.x_window_id = 0;
128 } 129 }
129 130
130 void GtkNativeViewManager::OnDestroy(gfx::NativeView widget) { 131 void GtkNativeViewManager::OnDestroy(gfx::NativeView widget) {
131 AutoLock locked(lock_); 132 AutoLock locked(lock_);
132 133
133 std::map<gfx::NativeView, gfx::NativeViewId>::iterator i = 134 std::map<gfx::NativeView, gfx::NativeViewId>::iterator i =
134 native_view_to_id_.find(widget); 135 native_view_to_id_.find(widget);
135 CHECK(i != native_view_to_id_.end()); 136 CHECK(i != native_view_to_id_.end());
136 137
137 std::map<gfx::NativeViewId, NativeViewInfo>::iterator j = 138 std::map<gfx::NativeViewId, NativeViewInfo>::iterator j =
138 id_to_info_.find(i->second); 139 id_to_info_.find(i->second);
139 CHECK(j != id_to_info_.end()); 140 CHECK(j != id_to_info_.end());
140 141
141 native_view_to_id_.erase(i); 142 native_view_to_id_.erase(i);
142 id_to_info_.erase(j); 143 id_to_info_.erase(j);
143 } 144 }
144 145
145 // ----------------------------------------------------------------------------- 146 // -----------------------------------------------------------------------------
OLDNEW
« no previous file with comments | « gfx/gtk_native_view_id_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine