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

Side by Side Diff: content/common/gpu/media/rendering_helper.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/common/gpu/media/rendering_helper.h" 5 #include "content/common/gpu/media/rendering_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/mac/scoped_nsautorelease_pool.h" 8 #include "base/mac/scoped_nsautorelease_pool.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/stringize_macros.h" 10 #include "base/strings/stringize_macros.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "ui/gl/gl_context.h" 12 #include "ui/gl/gl_context.h"
13 #include "ui/gl/gl_context_stub_with_extensions.h" 13 #include "ui/gl/gl_context_stub_with_extensions.h"
14 #include "ui/gl/gl_implementation.h" 14 #include "ui/gl/gl_implementation.h"
15 #include "ui/gl/gl_surface.h" 15 #include "ui/gl/gl_surface.h"
16 16
17 #ifdef GL_VARIANT_GLX 17 #ifdef GL_VARIANT_GLX
18 typedef GLXWindow NativeWindowType; 18 typedef GLXWindow NativeWindowType;
19 struct ScopedPtrXFree { 19 struct XFreeDeleter {
20 void operator()(void* x) const { ::XFree(x); } 20 void operator()(void* x) const { ::XFree(x); }
21 }; 21 };
22 #else // EGL 22 #else // EGL
23 typedef EGLNativeWindowType NativeWindowType; 23 typedef EGLNativeWindowType NativeWindowType;
24 #endif 24 #endif
25 25
26 // Helper for Shader creation. 26 // Helper for Shader creation.
27 static void CreateShader(GLuint program, 27 static void CreateShader(GLuint program,
28 GLenum type, 28 GLenum type,
29 const char* source, 29 const char* source,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 CHECK(glXQueryVersion(x_display_, NULL, NULL)); 117 CHECK(glXQueryVersion(x_display_, NULL, NULL));
118 const int fbconfig_attr[] = { 118 const int fbconfig_attr[] = {
119 GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, 119 GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
120 GLX_RENDER_TYPE, GLX_RGBA_BIT, 120 GLX_RENDER_TYPE, GLX_RGBA_BIT,
121 GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, 121 GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT,
122 GLX_BIND_TO_TEXTURE_RGB_EXT, GL_TRUE, 122 GLX_BIND_TO_TEXTURE_RGB_EXT, GL_TRUE,
123 GLX_DOUBLEBUFFER, True, 123 GLX_DOUBLEBUFFER, True,
124 GL_NONE, 124 GL_NONE,
125 }; 125 };
126 int num_fbconfigs; 126 int num_fbconfigs;
127 scoped_ptr_malloc<GLXFBConfig, ScopedPtrXFree> glx_fb_configs( 127 scoped_ptr<GLXFBConfig, XFreeDeleter> glx_fb_configs(
128 glXChooseFBConfig(x_display_, DefaultScreen(x_display_), fbconfig_attr, 128 glXChooseFBConfig(x_display_, DefaultScreen(x_display_), fbconfig_attr,
129 &num_fbconfigs)); 129 &num_fbconfigs));
130 CHECK(glx_fb_configs.get()); 130 CHECK(glx_fb_configs.get());
131 CHECK_GT(num_fbconfigs, 0); 131 CHECK_GT(num_fbconfigs, 0);
132 x_visual_ = glXGetVisualFromFBConfig(x_display_, glx_fb_configs.get()[0]); 132 x_visual_ = glXGetVisualFromFBConfig(x_display_, glx_fb_configs.get()[0]);
133 CHECK(x_visual_); 133 CHECK(x_visual_);
134 gl_context_ = glXCreateContext(x_display_, x_visual_, 0, true); 134 gl_context_ = glXCreateContext(x_display_, x_visual_, 0, true);
135 CHECK(gl_context_); 135 CHECK(gl_context_);
136 stub_context->AddExtensionsString( 136 stub_context->AddExtensionsString(
137 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); 137 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)));
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 *rgb_ptr++ = *rgba_ptr++; 555 *rgb_ptr++ = *rgba_ptr++;
556 solid = solid && (*rgba_ptr == 0xff); 556 solid = solid && (*rgba_ptr == 0xff);
557 rgba_ptr++; 557 rgba_ptr++;
558 } 558 }
559 *alpha_solid = solid; 559 *alpha_solid = solid;
560 560
561 done->Signal(); 561 done->Signal();
562 } 562 }
563 563
564 } // namespace content 564 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/wifi_data_provider_win.cc ('k') | content/common/gpu/media/vaapi_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698