OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 "app/gtk_signal_registrar.h" | 5 #include "ui/base/gtk/gtk_signal_registrar.h" |
6 | 6 |
7 #include <glib-object.h> | 7 #include <glib-object.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
| 11 namespace ui { |
| 12 |
11 GtkSignalRegistrar::GtkSignalRegistrar() { | 13 GtkSignalRegistrar::GtkSignalRegistrar() { |
12 } | 14 } |
13 | 15 |
14 GtkSignalRegistrar::~GtkSignalRegistrar() { | 16 GtkSignalRegistrar::~GtkSignalRegistrar() { |
15 for (HandlerMap::iterator list_iter = handler_lists_.begin(); | 17 for (HandlerMap::iterator list_iter = handler_lists_.begin(); |
16 list_iter != handler_lists_.end(); ++list_iter) { | 18 list_iter != handler_lists_.end(); ++list_iter) { |
17 GObject* object = list_iter->first; | 19 GObject* object = list_iter->first; |
18 g_object_weak_unref(object, WeakNotifyThunk, this); | 20 g_object_weak_unref(object, WeakNotifyThunk, this); |
19 | 21 |
20 HandlerList& handlers = list_iter->second; | 22 HandlerList& handlers = list_iter->second; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 void GtkSignalRegistrar::WeakNotify(GObject* where_the_object_was) { | 67 void GtkSignalRegistrar::WeakNotify(GObject* where_the_object_was) { |
66 HandlerMap::iterator iter = handler_lists_.find(where_the_object_was); | 68 HandlerMap::iterator iter = handler_lists_.find(where_the_object_was); |
67 if (iter == handler_lists_.end()) { | 69 if (iter == handler_lists_.end()) { |
68 NOTREACHED(); | 70 NOTREACHED(); |
69 return; | 71 return; |
70 } | 72 } |
71 // The signal handlers will be disconnected automatically. Just erase the | 73 // The signal handlers will be disconnected automatically. Just erase the |
72 // handler id list. | 74 // handler id list. |
73 handler_lists_.erase(iter); | 75 handler_lists_.erase(iter); |
74 } | 76 } |
| 77 |
| 78 } // namespace ui |
OLD | NEW |