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

Side by Side Diff: gfx/gtk_native_view_id_manager.cc

Issue 5581008: Add a new GetInstance() method for singleton classes, take 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "gfx/gtk_native_view_id_manager.h" 5 #include "gfx/gtk_native_view_id_manager.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 23 matching lines...) Expand all
34 34
35 // ----------------------------------------------------------------------------- 35 // -----------------------------------------------------------------------------
36 // Public functions... 36 // Public functions...
37 37
38 GtkNativeViewManager::GtkNativeViewManager() { 38 GtkNativeViewManager::GtkNativeViewManager() {
39 } 39 }
40 40
41 GtkNativeViewManager::~GtkNativeViewManager() { 41 GtkNativeViewManager::~GtkNativeViewManager() {
42 } 42 }
43 43
44 // static
45 GtkNativeViewManager* GtkNativeViewManager::GetInstance() {
46 return Singleton<GtkNativeViewManager>::get();
47 }
48
44 gfx::NativeViewId GtkNativeViewManager::GetIdForWidget(gfx::NativeView widget) { 49 gfx::NativeViewId GtkNativeViewManager::GetIdForWidget(gfx::NativeView widget) {
45 // This is just for unit tests: 50 // This is just for unit tests:
46 if (!widget) 51 if (!widget)
47 return 0; 52 return 0;
48 53
49 AutoLock locked(lock_); 54 AutoLock locked(lock_);
50 55
51 std::map<gfx::NativeView, gfx::NativeViewId>::const_iterator i = 56 std::map<gfx::NativeView, gfx::NativeViewId>::const_iterator i =
52 native_view_to_id_.find(widget); 57 native_view_to_id_.find(widget);
53 58
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 214
210 if (k != perm_xid_to_info_.end()) 215 if (k != perm_xid_to_info_.end())
211 k->second.widget = NULL; 216 k->second.widget = NULL;
212 } 217 }
213 218
214 native_view_to_id_.erase(i); 219 native_view_to_id_.erase(i);
215 id_to_info_.erase(j); 220 id_to_info_.erase(j);
216 } 221 }
217 222
218 // ----------------------------------------------------------------------------- 223 // -----------------------------------------------------------------------------
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698