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

Side by Side Diff: chrome/browser/ui/libgtkui/gtk_util.h

Issue 2696903003: Gtk3: Fix memory leaks (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_status_icon.cc ('k') | chrome/browser/ui/libgtkui/gtk_util.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ 5 #ifndef CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_
6 #define CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ 6 #define CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // a parent whose only reference was the child context in question. 158 // a parent whose only reference was the child context in question.
159 // This is a hack to work around that case. See GTK commit 159 // This is a hack to work around that case. See GTK commit
160 // "gtkstylecontext: Don't try to emit a signal when finalizing". 160 // "gtkstylecontext: Don't try to emit a signal when finalizing".
161 GtkStyleContext* context = obj_; 161 GtkStyleContext* context = obj_;
162 while (context) { 162 while (context) {
163 GtkStyleContext* parent = gtk_style_context_get_parent(context); 163 GtkStyleContext* parent = gtk_style_context_get_parent(context);
164 if (parent && G_OBJECT(context)->ref_count == 1 && 164 if (parent && G_OBJECT(context)->ref_count == 1 &&
165 !GtkVersionCheck(3, 15, 4)) { 165 !GtkVersionCheck(3, 15, 4)) {
166 g_object_ref(parent); 166 g_object_ref(parent);
167 gtk_style_context_set_parent(context, nullptr); 167 gtk_style_context_set_parent(context, nullptr);
168 g_object_unref(context);
168 } else { 169 } else {
169 g_object_unref(context); 170 g_object_unref(context);
170 return; 171 return;
171 } 172 }
172 context = parent; 173 context = parent;
173 } 174 }
174 } 175 }
175 176
176 typedef ScopedGObject<GtkStyleContext> ScopedStyleContext; 177 typedef ScopedGObject<GtkStyleContext> ScopedStyleContext;
177 typedef ScopedGObject<GtkCssProvider> ScopedCssProvider; 178 typedef ScopedGObject<GtkCssProvider> ScopedCssProvider;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 SkColor GetSelectedTextColor(const char* css_selector); 220 SkColor GetSelectedTextColor(const char* css_selector);
220 SkColor GetSelectedBgColor(const char* css_selector); 221 SkColor GetSelectedBgColor(const char* css_selector);
221 222
222 // Get the color of the GtkSeparator specified by |css_selector|. 223 // Get the color of the GtkSeparator specified by |css_selector|.
223 SkColor GetSeparatorColor(const char* css_selector); 224 SkColor GetSeparatorColor(const char* css_selector);
224 #endif 225 #endif
225 226
226 } // namespace libgtkui 227 } // namespace libgtkui
227 228
228 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_ 229 #endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_status_icon.cc ('k') | chrome/browser/ui/libgtkui/gtk_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698