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

Side by Side Diff: ui/base/gtk/owned_widget_gtk.cc

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/base/gtk/owned_widget_gtk.h"
6
7 #include <gtk/gtk.h>
8
9 #include "base/logging.h"
10
11 #error "The GTK+ port will be deleted later this week. If you are seeing this, y ou are trying to compile it. Please check your gyp flags for 'use_aura=0' and re move them."
12
13 namespace ui {
14
15 OwnedWidgetGtk::~OwnedWidgetGtk() {
16 Destroy();
17 }
18
19 void OwnedWidgetGtk::Own(GtkWidget* widget) {
20 if (!widget)
21 return;
22
23 DCHECK(!widget_);
24 // We want to make sure that Own() was called properly, right after the
25 // widget was created. There should be a floating reference.
26 DCHECK(g_object_is_floating(widget));
27
28 // Sink the floating reference, we should now own this reference.
29 g_object_ref_sink(widget);
30 widget_ = widget;
31 }
32
33 void OwnedWidgetGtk::Destroy() {
34 if (!widget_)
35 return;
36
37 GtkWidget* widget = widget_;
38 widget_ = NULL;
39 gtk_widget_destroy(widget);
40
41 DCHECK(!g_object_is_floating(widget));
42 // NOTE: Assumes some implementation details about glib internals.
43 DCHECK_EQ(G_OBJECT(widget)->ref_count, 1U);
44 g_object_unref(widget);
45 }
46
47 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698