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

Side by Side Diff: app/surface/io_surface_support_mac.cc

Issue 5685007: Rename all methods accessing Singleton<T> as GetInstance(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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
« no previous file with comments | « app/active_window_watcher_x.cc ('k') | base/debug/stack_trace_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <dlfcn.h> 5 #include <dlfcn.h>
6 6
7 #include "base/singleton.h" 7 #include "base/singleton.h"
8 #include "app/surface/io_surface_support_mac.h" 8 #include "app/surface/io_surface_support_mac.h"
9 9
10 typedef CFTypeRef (*IOSurfaceCreateProcPtr)(CFDictionaryRef properties); 10 typedef CFTypeRef (*IOSurfaceCreateProcPtr)(CFDictionaryRef properties);
11 typedef uint32 (*IOSurfaceGetIDProcPtr)(CFTypeRef io_surface); 11 typedef uint32 (*IOSurfaceGetIDProcPtr)(CFTypeRef io_surface);
12 typedef CFTypeRef (*IOSurfaceLookupProcPtr)(uint32 io_surface_id); 12 typedef CFTypeRef (*IOSurfaceLookupProcPtr)(uint32 io_surface_id);
13 typedef mach_port_t (*IOSurfaceCreateMachPortProcPtr)(CFTypeRef io_surface); 13 typedef mach_port_t (*IOSurfaceCreateMachPortProcPtr)(CFTypeRef io_surface);
14 typedef CFTypeRef (*IOSurfaceLookupFromMachPortProcPtr)(mach_port_t port); 14 typedef CFTypeRef (*IOSurfaceLookupFromMachPortProcPtr)(mach_port_t port);
15 typedef size_t (*IOSurfaceGetWidthPtr)(CFTypeRef io_surface); 15 typedef size_t (*IOSurfaceGetWidthPtr)(CFTypeRef io_surface);
16 typedef size_t (*IOSurfaceGetHeightPtr)(CFTypeRef io_surface); 16 typedef size_t (*IOSurfaceGetHeightPtr)(CFTypeRef io_surface);
17 typedef CGLError (*CGLTexImageIOSurface2DProcPtr)(CGLContextObj ctx, 17 typedef CGLError (*CGLTexImageIOSurface2DProcPtr)(CGLContextObj ctx,
18 GLenum target, 18 GLenum target,
19 GLenum internal_format, 19 GLenum internal_format,
20 GLsizei width, 20 GLsizei width,
21 GLsizei height, 21 GLsizei height,
22 GLenum format, 22 GLenum format,
23 GLenum type, 23 GLenum type,
24 CFTypeRef io_surface, 24 CFTypeRef io_surface,
25 GLuint plane); 25 GLuint plane);
26 26
27 class IOSurfaceSupportImpl : public IOSurfaceSupport { 27 class IOSurfaceSupportImpl : public IOSurfaceSupport {
28 public: 28 public:
29 static IOSurfaceSupportImpl* Initialize(); 29 static IOSurfaceSupportImpl* GetInstance();
30 30
31 bool InitializedSuccessfully() { 31 bool InitializedSuccessfully() {
32 return initialized_successfully_; 32 return initialized_successfully_;
33 } 33 }
34 34
35 virtual CFStringRef GetKIOSurfaceWidth(); 35 virtual CFStringRef GetKIOSurfaceWidth();
36 virtual CFStringRef GetKIOSurfaceHeight(); 36 virtual CFStringRef GetKIOSurfaceHeight();
37 virtual CFStringRef GetKIOSurfaceBytesPerElement(); 37 virtual CFStringRef GetKIOSurfaceBytesPerElement();
38 virtual CFStringRef GetKIOSurfaceIsGlobal(); 38 virtual CFStringRef GetKIOSurfaceIsGlobal();
39 39
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 IOSurfaceLookupFromMachPortProcPtr io_surface_lookup_from_mach_port_; 73 IOSurfaceLookupFromMachPortProcPtr io_surface_lookup_from_mach_port_;
74 IOSurfaceGetWidthPtr io_surface_get_width_; 74 IOSurfaceGetWidthPtr io_surface_get_width_;
75 IOSurfaceGetHeightPtr io_surface_get_height_; 75 IOSurfaceGetHeightPtr io_surface_get_height_;
76 CGLTexImageIOSurface2DProcPtr cgl_tex_image_io_surface_2d_; 76 CGLTexImageIOSurface2DProcPtr cgl_tex_image_io_surface_2d_;
77 bool initialized_successfully_; 77 bool initialized_successfully_;
78 78
79 friend struct DefaultSingletonTraits<IOSurfaceSupportImpl>; 79 friend struct DefaultSingletonTraits<IOSurfaceSupportImpl>;
80 DISALLOW_COPY_AND_ASSIGN(IOSurfaceSupportImpl); 80 DISALLOW_COPY_AND_ASSIGN(IOSurfaceSupportImpl);
81 }; 81 };
82 82
83 IOSurfaceSupportImpl* IOSurfaceSupportImpl::Initialize() { 83 IOSurfaceSupportImpl* IOSurfaceSupportImpl::GetInstance() {
84 IOSurfaceSupportImpl* impl = Singleton<IOSurfaceSupportImpl>::get(); 84 IOSurfaceSupportImpl* impl = Singleton<IOSurfaceSupportImpl>::get();
85 if (impl->InitializedSuccessfully()) 85 if (impl->InitializedSuccessfully())
86 return impl; 86 return impl;
87 return NULL; 87 return NULL;
88 } 88 }
89 89
90 CFStringRef IOSurfaceSupportImpl::GetKIOSurfaceWidth() { 90 CFStringRef IOSurfaceSupportImpl::GetKIOSurfaceWidth() {
91 return k_io_surface_width_; 91 return k_io_surface_width_;
92 } 92 }
93 93
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } 252 }
253 253
254 IOSurfaceSupportImpl::~IOSurfaceSupportImpl() { 254 IOSurfaceSupportImpl::~IOSurfaceSupportImpl() {
255 if (iosurface_handle_) 255 if (iosurface_handle_)
256 dlclose(iosurface_handle_); 256 dlclose(iosurface_handle_);
257 if (opengl_handle_) 257 if (opengl_handle_)
258 dlclose(opengl_handle_); 258 dlclose(opengl_handle_);
259 } 259 }
260 260
261 IOSurfaceSupport* IOSurfaceSupport::Initialize() { 261 IOSurfaceSupport* IOSurfaceSupport::Initialize() {
262 return IOSurfaceSupportImpl::Initialize(); 262 return IOSurfaceSupportImpl::GetInstance();
263 } 263 }
264 264
265 IOSurfaceSupport::IOSurfaceSupport() { 265 IOSurfaceSupport::IOSurfaceSupport() {
266 } 266 }
267 267
268 IOSurfaceSupport::~IOSurfaceSupport() { 268 IOSurfaceSupport::~IOSurfaceSupport() {
269 } 269 }
270 270
OLDNEW
« no previous file with comments | « app/active_window_watcher_x.cc ('k') | base/debug/stack_trace_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698