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

Side by Side Diff: gfx/gtk_util.h

Issue 2804042: Incomplete changes to make scoped_ptr_malloc use plain functions. (Closed)
Patch Set: chrome now builds & links Created 10 years, 5 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
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 #ifndef GFX_GTK_UTIL_H_ 5 #ifndef GFX_GTK_UTIL_H_
6 #define GFX_GTK_UTIL_H_ 6 #define GFX_GTK_UTIL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Modify the given region by subtracting the given rectangles. 43 // Modify the given region by subtracting the given rectangles.
44 void SubtractRectanglesFromRegion(GdkRegion* region, 44 void SubtractRectanglesFromRegion(GdkRegion* region,
45 const std::vector<Rect>& cutouts); 45 const std::vector<Rect>& cutouts);
46 46
47 // Returns the resolution (DPI) used by pango. A negative values means the 47 // Returns the resolution (DPI) used by pango. A negative values means the
48 // resolution hasn't been set. 48 // resolution hasn't been set.
49 double GetPangoResolution(); 49 double GetPangoResolution();
50 50
51 } // namespace gfx 51 } // namespace gfx
52 52
53 namespace {
54 // A helper class that will g_object_unref |p| when it goes out of scope.
55 // This never adds a ref, it only unrefs.
56 template <typename Type>
57 struct GObjectUnrefer {
58 void operator()(Type* ptr) const {
59 if (ptr)
60 g_object_unref(ptr);
61 }
62 };
63 } // namespace
64
65 // It's not legal C++ to have a templatized typedefs, so we wrap it in a 53 // It's not legal C++ to have a templatized typedefs, so we wrap it in a
66 // struct. When using this, you need to include ::Type. E.g., 54 // struct. When using this, you need to include ::Type. E.g.,
67 // ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new()); 55 // ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new());
68 template<class T> 56 template<class T>
69 struct ScopedGObject { 57 struct ScopedGObject {
70 typedef scoped_ptr_malloc<T, GObjectUnrefer<T> > Type; 58 typedef scoped_ptr_malloc<T, FreeFnAdapter<g_object_unref> > Type;
71 }; 59 };
72 60
73 #endif // GFX_GTK_UTIL_H_ 61 #endif // GFX_GTK_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h ('k') | media/ffmpeg/ffmpeg_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698