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

Side by Side Diff: content/browser/renderer_host/compositing_iosurface_context_mac.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/renderer_host/compositing_iosurface_context_mac.h" 5 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h"
6 6
7 #include <OpenGL/gl.h> 7 #include <OpenGL/gl.h>
8 #include <OpenGL/OpenGL.h> 8 #include <OpenGL/OpenGL.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 std::vector<NSOpenGLPixelFormatAttribute> attributes; 32 std::vector<NSOpenGLPixelFormatAttribute> attributes;
33 attributes.push_back(NSOpenGLPFADoubleBuffer); 33 attributes.push_back(NSOpenGLPFADoubleBuffer);
34 // We don't need a depth buffer - try setting its size to 0... 34 // We don't need a depth buffer - try setting its size to 0...
35 attributes.push_back(NSOpenGLPFADepthSize); attributes.push_back(0); 35 attributes.push_back(NSOpenGLPFADepthSize); attributes.push_back(0);
36 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) 36 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus())
37 attributes.push_back(NSOpenGLPFAAllowOfflineRenderers); 37 attributes.push_back(NSOpenGLPFAAllowOfflineRenderers);
38 attributes.push_back(0); 38 attributes.push_back(0);
39 39
40 scoped_nsobject<NSOpenGLPixelFormat> glPixelFormat( 40 base::scoped_nsobject<NSOpenGLPixelFormat> glPixelFormat(
41 [[NSOpenGLPixelFormat alloc] initWithAttributes:&attributes.front()]); 41 [[NSOpenGLPixelFormat alloc] initWithAttributes:&attributes.front()]);
42 if (!glPixelFormat) { 42 if (!glPixelFormat) {
43 LOG(ERROR) << "NSOpenGLPixelFormat initWithAttributes failed"; 43 LOG(ERROR) << "NSOpenGLPixelFormat initWithAttributes failed";
44 return NULL; 44 return NULL;
45 } 45 }
46 46
47 // Create all contexts in the same share group so that the textures don't 47 // Create all contexts in the same share group so that the textures don't
48 // need to be recreated when transitioning contexts. 48 // need to be recreated when transitioning contexts.
49 NSOpenGLContext* share_context = nil; 49 NSOpenGLContext* share_context = nil;
50 if (!window_map()->empty()) 50 if (!window_map()->empty())
51 share_context = window_map()->begin()->second->nsgl_context(); 51 share_context = window_map()->begin()->second->nsgl_context();
52 scoped_nsobject<NSOpenGLContext> nsgl_context( 52 base::scoped_nsobject<NSOpenGLContext> nsgl_context(
53 [[NSOpenGLContext alloc] initWithFormat:glPixelFormat 53 [[NSOpenGLContext alloc] initWithFormat:glPixelFormat
54 shareContext:share_context]); 54 shareContext:share_context]);
55 if (!nsgl_context) { 55 if (!nsgl_context) {
56 LOG(ERROR) << "NSOpenGLContext initWithFormat failed"; 56 LOG(ERROR) << "NSOpenGLContext initWithFormat failed";
57 return NULL; 57 return NULL;
58 } 58 }
59 59
60 CGLContextObj cgl_context = (CGLContextObj)[nsgl_context CGLContextObj]; 60 CGLContextObj cgl_context = (CGLContextObj)[nsgl_context CGLContextObj];
61 if (!cgl_context) { 61 if (!cgl_context) {
62 LOG(ERROR) << "CGLContextObj failed"; 62 LOG(ERROR) << "CGLContextObj failed";
63 return NULL; 63 return NULL;
64 } 64 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 CompositingIOSurfaceContext::WindowMap* 137 CompositingIOSurfaceContext::WindowMap*
138 CompositingIOSurfaceContext::window_map() { 138 CompositingIOSurfaceContext::window_map() {
139 return window_map_.Pointer(); 139 return window_map_.Pointer();
140 } 140 }
141 141
142 // static 142 // static
143 base::LazyInstance<CompositingIOSurfaceContext::WindowMap> 143 base::LazyInstance<CompositingIOSurfaceContext::WindowMap>
144 CompositingIOSurfaceContext::window_map_; 144 CompositingIOSurfaceContext::window_map_;
145 145
146 } // namespace content 146 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698