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

Side by Side Diff: content/common/gpu/media/vaapi_video_decode_accelerator.cc

Issue 168643002: Convert scoped_ptr_malloc -> scoped_ptr, part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/debug/trace_event.h" 6 #include "base/debug/trace_event.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 finish_flush_pending_(false), 256 finish_flush_pending_(false),
257 awaiting_va_surfaces_recycle_(false), 257 awaiting_va_surfaces_recycle_(false),
258 requested_num_pics_(0) { 258 requested_num_pics_(0) {
259 DCHECK(client); 259 DCHECK(client);
260 } 260 }
261 261
262 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { 262 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() {
263 DCHECK_EQ(message_loop_, base::MessageLoop::current()); 263 DCHECK_EQ(message_loop_, base::MessageLoop::current());
264 } 264 }
265 265
266 class ScopedPtrXFree { 266 class XFreeDeleter {
267 public: 267 public:
268 void operator()(void* x) const { 268 void operator()(void* x) const {
269 ::XFree(x); 269 ::XFree(x);
270 } 270 }
271 }; 271 };
272 272
273 bool VaapiVideoDecodeAccelerator::InitializeFBConfig() { 273 bool VaapiVideoDecodeAccelerator::InitializeFBConfig() {
274 const int fbconfig_attr[] = { 274 const int fbconfig_attr[] = {
275 GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, 275 GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT,
276 GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, 276 GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT,
277 GLX_BIND_TO_TEXTURE_RGB_EXT, GL_TRUE, 277 GLX_BIND_TO_TEXTURE_RGB_EXT, GL_TRUE,
278 GLX_Y_INVERTED_EXT, GL_TRUE, 278 GLX_Y_INVERTED_EXT, GL_TRUE,
279 GL_NONE, 279 GL_NONE,
280 }; 280 };
281 281
282 int num_fbconfigs; 282 int num_fbconfigs;
283 scoped_ptr_malloc<GLXFBConfig, ScopedPtrXFree> glx_fb_configs( 283 scoped_ptr<GLXFBConfig, XFreeDeleter> glx_fb_configs(
284 glXChooseFBConfig(x_display_, DefaultScreen(x_display_), fbconfig_attr, 284 glXChooseFBConfig(x_display_, DefaultScreen(x_display_), fbconfig_attr,
285 &num_fbconfigs)); 285 &num_fbconfigs));
286 if (!glx_fb_configs) 286 if (!glx_fb_configs)
287 return false; 287 return false;
288 if (!num_fbconfigs) 288 if (!num_fbconfigs)
289 return false; 289 return false;
290 290
291 fb_config_ = glx_fb_configs.get()[0]; 291 fb_config_ = glx_fb_configs.get()[0];
292 return true; 292 return true;
293 } 293 }
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 state_ = kUninitialized; 921 state_ = kUninitialized;
922 } 922 }
923 923
924 void VaapiVideoDecodeAccelerator::Destroy() { 924 void VaapiVideoDecodeAccelerator::Destroy() {
925 DCHECK_EQ(message_loop_, base::MessageLoop::current()); 925 DCHECK_EQ(message_loop_, base::MessageLoop::current());
926 Cleanup(); 926 Cleanup();
927 delete this; 927 delete this;
928 } 928 }
929 929
930 } // namespace content 930 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/rendering_helper.cc ('k') | content/common/sandbox_mac_diraccess_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698