| OLD | NEW |
| 1 // Copyright (c) 2011 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 "ui/base/gtk/g_object_destructor_filo.h" | 5 #include "ui/base/gtk/g_object_destructor_filo.h" |
| 6 | 6 |
| 7 #include <glib-object.h> | 7 #include <glib-object.h> |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 << ": hook not found (" << callback << ", " << context << ")."; | 42 << ": hook not found (" << callback << ", " << context << ")."; |
| 43 return; | 43 return; |
| 44 } | 44 } |
| 45 HandlerList& dtors = iter->second; | 45 HandlerList& dtors = iter->second; |
| 46 if (dtors.empty()) { | 46 if (dtors.empty()) { |
| 47 LOG(DFATAL) << "Destructor list is empty for specified object " << object | 47 LOG(DFATAL) << "Destructor list is empty for specified object " << object |
| 48 << " Maybe it is being executed?"; | 48 << " Maybe it is being executed?"; |
| 49 return; | 49 return; |
| 50 } | 50 } |
| 51 if (!dtors.front().equal(object, callback, context)) { | 51 if (!dtors.front().equal(object, callback, context)) { |
| 52 LOG(WARNING) << "Destructors should be unregistered the reverse order they " | 52 // Reenable this warning once this bug is fixed: |
| 53 << "were registered. But for object " << object << " " | 53 // http://code.google.com/p/chromium/issues/detail?id=85603 |
| 54 << "deleted hook is "<< context << ", the last queued hook is " | 54 VLOG(1) << "Destructors should be unregistered the reverse order they " |
| 55 << dtors.front().context; | 55 << "were registered. But for object " << object << " " |
| 56 << "deleted hook is "<< context << ", the last queued hook is " |
| 57 << dtors.front().context; |
| 56 } | 58 } |
| 57 for (HandlerList::iterator i = dtors.begin(); i != dtors.end(); ++i) { | 59 for (HandlerList::iterator i = dtors.begin(); i != dtors.end(); ++i) { |
| 58 if (i->equal(object, callback, context)) { | 60 if (i->equal(object, callback, context)) { |
| 59 dtors.erase(i); | 61 dtors.erase(i); |
| 60 break; | 62 break; |
| 61 } | 63 } |
| 62 } | 64 } |
| 63 if (dtors.empty()) { | 65 if (dtors.empty()) { |
| 64 g_object_weak_unref(object, WeakNotifyThunk, this); | 66 g_object_weak_unref(object, WeakNotifyThunk, this); |
| 65 handler_map_.erase(iter); | 67 handler_map_.erase(iter); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 76 HandlerList dtors; | 78 HandlerList dtors; |
| 77 iter->second.swap(dtors); | 79 iter->second.swap(dtors); |
| 78 handler_map_.erase(iter); | 80 handler_map_.erase(iter); |
| 79 | 81 |
| 80 // Execute hooks in local list in FILO order. | 82 // Execute hooks in local list in FILO order. |
| 81 for (HandlerList::iterator i = dtors.begin(); i != dtors.end(); ++i) | 83 for (HandlerList::iterator i = dtors.begin(); i != dtors.end(); ++i) |
| 82 i->callback(i->context, where_the_object_was); | 84 i->callback(i->context, where_the_object_was); |
| 83 } | 85 } |
| 84 | 86 |
| 85 } // napespace ui | 87 } // napespace ui |
| OLD | NEW |