OLD | NEW |
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); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 static Singleton<IOSurfaceSupportImpl> sole_instance_; | |
84 | |
85 IOSurfaceSupportImpl* IOSurfaceSupportImpl::Initialize() { | 83 IOSurfaceSupportImpl* IOSurfaceSupportImpl::Initialize() { |
86 IOSurfaceSupportImpl* impl = sole_instance_.get(); | 84 IOSurfaceSupportImpl* impl = Singleton<IOSurfaceSupportImpl>::get(); |
87 if (impl->InitializedSuccessfully()) | 85 if (impl->InitializedSuccessfully()) |
88 return impl; | 86 return impl; |
89 return NULL; | 87 return NULL; |
90 } | 88 } |
91 | 89 |
92 CFStringRef IOSurfaceSupportImpl::GetKIOSurfaceWidth() { | 90 CFStringRef IOSurfaceSupportImpl::GetKIOSurfaceWidth() { |
93 return k_io_surface_width_; | 91 return k_io_surface_width_; |
94 } | 92 } |
95 | 93 |
96 CFStringRef IOSurfaceSupportImpl::GetKIOSurfaceHeight() { | 94 CFStringRef IOSurfaceSupportImpl::GetKIOSurfaceHeight() { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 IOSurfaceSupport* IOSurfaceSupport::Initialize() { | 261 IOSurfaceSupport* IOSurfaceSupport::Initialize() { |
264 return IOSurfaceSupportImpl::Initialize(); | 262 return IOSurfaceSupportImpl::Initialize(); |
265 } | 263 } |
266 | 264 |
267 IOSurfaceSupport::IOSurfaceSupport() { | 265 IOSurfaceSupport::IOSurfaceSupport() { |
268 } | 266 } |
269 | 267 |
270 IOSurfaceSupport::~IOSurfaceSupport() { | 268 IOSurfaceSupport::~IOSurfaceSupport() { |
271 } | 269 } |
272 | 270 |
OLD | NEW |