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

Unified Diff: ui/base/x/x11_util.h

Issue 989993002: x11: Use scoped_ptr<> for X11 objects where it makes sense. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 9 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
« no previous file with comments | « ui/base/x/selection_owner.cc ('k') | ui/base/x/x11_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/x/x11_util.h
diff --git a/ui/base/x/x11_util.h b/ui/base/x/x11_util.h
index ffcf8461c75613fe43ba39aeec23b08db6c298ed..36d7f40824be6658372cd1e4551e22a197a9d597 100644
--- a/ui/base/x/x11_util.h
+++ b/ui/base/x/x11_util.h
@@ -301,8 +301,7 @@ UI_BASE_EXPORT bool WmSupportsHint(XAtom atom);
// X11 allocator when done.
class UI_BASE_EXPORT XRefcountedMemory : public base::RefCountedMemory {
public:
- XRefcountedMemory(unsigned char* x11_data, size_t length)
- : x11_data_(length ? x11_data : NULL), length_(length) {}
+ XRefcountedMemory(unsigned char* x11_data, size_t length);
// Overridden from RefCountedMemory:
const unsigned char* front() const override;
@@ -311,27 +310,12 @@ class UI_BASE_EXPORT XRefcountedMemory : public base::RefCountedMemory {
private:
~XRefcountedMemory() override;
- unsigned char* x11_data_;
+ gfx::XScopedPtr<unsigned char> x11_data_;
size_t length_;
DISALLOW_COPY_AND_ASSIGN(XRefcountedMemory);
};
-// Keeps track of a string returned by an X function (e.g. XGetAtomName) and
-// makes sure it's XFree'd.
-class UI_BASE_EXPORT XScopedString {
- public:
- explicit XScopedString(char* str) : string_(str) {}
- ~XScopedString();
-
- const char* string() const { return string_; }
-
- private:
- char* string_;
-
- DISALLOW_COPY_AND_ASSIGN(XScopedString);
-};
-
// Keeps track of an image returned by an X function (e.g. XGetImage) and
// makes sure it's XDestroyImage'd.
class UI_BASE_EXPORT XScopedImage {
« no previous file with comments | « ui/base/x/selection_owner.cc ('k') | ui/base/x/x11_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698