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

Unified Diff: ui/base/gtk/g_object_destructor_filo.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 side-by-side diff with in-line comments
Download patch
Index: ui/base/gtk/g_object_destructor_filo.cc
diff --git a/ui/base/gtk/g_object_destructor_filo.cc b/ui/base/gtk/g_object_destructor_filo.cc
deleted file mode 100644
index fe253c799b0597a81d6d6894f89ec6bb759a680b..0000000000000000000000000000000000000000
--- a/ui/base/gtk/g_object_destructor_filo.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/base/gtk/g_object_destructor_filo.h"
-
-#include <glib-object.h>
-
-#include "base/logging.h"
-#include "base/memory/singleton.h"
-
-namespace ui {
-
-GObjectDestructorFILO::GObjectDestructorFILO() {
-}
-
-GObjectDestructorFILO::~GObjectDestructorFILO() {
- // Probably CHECK(handler_map_.empty()) would look natural here. But
- // some tests (some views_unittests) violate this assertion.
-}
-
-// static
-GObjectDestructorFILO* GObjectDestructorFILO::GetInstance() {
- return Singleton<GObjectDestructorFILO>::get();
-}
-
-void GObjectDestructorFILO::Connect(
- GObject* object, DestructorHook callback, void* context) {
- const Hook hook(object, callback, context);
- HandlerMap::iterator iter = handler_map_.find(object);
- if (iter == handler_map_.end()) {
- g_object_weak_ref(object, WeakNotifyThunk, this);
- handler_map_[object].push_front(hook);
- } else {
- iter->second.push_front(hook);
- }
-}
-
-void GObjectDestructorFILO::Disconnect(
- GObject* object, DestructorHook callback, void* context) {
- HandlerMap::iterator iter = handler_map_.find(object);
- if (iter == handler_map_.end()) {
- LOG(DFATAL) << "Unable to disconnect destructor hook for object " << object
- << ": hook not found (" << callback << ", " << context << ").";
- return;
- }
- HandlerList& dtors = iter->second;
- if (dtors.empty()) {
- LOG(DFATAL) << "Destructor list is empty for specified object " << object
- << " Maybe it is being executed?";
- return;
- }
- if (!dtors.front().equal(object, callback, context)) {
- // Reenable this warning once this bug is fixed:
- // http://code.google.com/p/chromium/issues/detail?id=85603
- DVLOG(1) << "Destructors should be unregistered the reverse order they "
- << "were registered. But for object " << object << " "
- << "deleted hook is "<< context << ", the last queued hook is "
- << dtors.front().context;
- }
- for (HandlerList::iterator i = dtors.begin(); i != dtors.end(); ++i) {
- if (i->equal(object, callback, context)) {
- dtors.erase(i);
- break;
- }
- }
- if (dtors.empty()) {
- g_object_weak_unref(object, WeakNotifyThunk, this);
- handler_map_.erase(iter);
- }
-}
-
-void GObjectDestructorFILO::WeakNotify(GObject* where_the_object_was) {
- HandlerMap::iterator iter = handler_map_.find(where_the_object_was);
- DCHECK(iter != handler_map_.end());
- DCHECK(!iter->second.empty());
-
- // Save destructor list for given object into local copy to avoid reentrancy
- // problem: if callee wants to modify the caller list.
- HandlerList dtors;
- iter->second.swap(dtors);
- handler_map_.erase(iter);
-
- // Execute hooks in local list in FILO order.
- for (HandlerList::iterator i = dtors.begin(); i != dtors.end(); ++i)
- i->callback(i->context, where_the_object_was);
-}
-
-} // napespace ui

Powered by Google App Engine
This is Rietveld 408576698