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

Side by Side Diff: ui/display/util/x11/edid_parser_x11.cc

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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/display/util/x11/edid_parser_x11.h" 5 #include "ui/display/util/x11/edid_parser_x11.h"
6 6
7 #include <X11/extensions/Xrandr.h> 7 #include <X11/extensions/Xrandr.h>
8 #include <X11/Xatom.h> 8 #include <X11/Xatom.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 10
(...skipping 21 matching lines...) Expand all
32 return false; 32 return false;
33 33
34 Display* display = gfx::GetXDisplay(); 34 Display* display = gfx::GetXDisplay();
35 35
36 static Atom edid_property = XInternAtom( 36 static Atom edid_property = XInternAtom(
37 gfx::GetXDisplay(), 37 gfx::GetXDisplay(),
38 RR_PROPERTY_RANDR_EDID, false); 38 RR_PROPERTY_RANDR_EDID, false);
39 39
40 bool has_edid_property = false; 40 bool has_edid_property = false;
41 int num_properties = 0; 41 int num_properties = 0;
42 Atom* properties = XRRListOutputProperties(display, output, &num_properties); 42 gfx::XScopedPtr<Atom[]> properties(
43 XRRListOutputProperties(display, output, &num_properties));
43 for (int i = 0; i < num_properties; ++i) { 44 for (int i = 0; i < num_properties; ++i) {
44 if (properties[i] == edid_property) { 45 if (properties[i] == edid_property) {
45 has_edid_property = true; 46 has_edid_property = true;
46 break; 47 break;
47 } 48 }
48 } 49 }
49 XFree(properties);
50 if (!has_edid_property) 50 if (!has_edid_property)
51 return false; 51 return false;
52 52
53 Atom actual_type; 53 Atom actual_type;
54 int actual_format; 54 int actual_format;
55 unsigned long bytes_after; 55 unsigned long bytes_after;
56 unsigned long nitems = 0; 56 unsigned long nitems = 0;
57 unsigned char* prop = nullptr; 57 unsigned char* prop = nullptr;
58 XRRGetOutputProperty(display, 58 XRRGetOutputProperty(display,
59 output, 59 output,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 bool GetOutputOverscanFlag(RROutput output, bool* flag) { 112 bool GetOutputOverscanFlag(RROutput output, bool* flag) {
113 std::vector<uint8_t> edid; 113 std::vector<uint8_t> edid;
114 if (!GetEDIDProperty(output, &edid)) 114 if (!GetEDIDProperty(output, &edid))
115 return false; 115 return false;
116 116
117 bool found = ParseOutputOverscanFlag(edid, flag); 117 bool found = ParseOutputOverscanFlag(edid, flag);
118 return found; 118 return found;
119 } 119 }
120 120
121 } // namespace ui 121 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/x11/native_display_delegate_x11.cc ('k') | ui/events/devices/x11/device_data_manager_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698