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

Side by Side Diff: ui/gl/gl_context_nsview.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, 5 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 "ui/gl/gl_context_nsview.h" 5 #include "ui/gl/gl_context_nsview.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #import <AppKit/NSOpenGL.h> 9 #import <AppKit/NSOpenGL.h>
10 #import <AppKit/NSView.h> 10 #import <AppKit/NSView.h>
(...skipping 14 matching lines...) Expand all
25 bool GLContextNSView::Initialize(GLSurface* surface, 25 bool GLContextNSView::Initialize(GLSurface* surface,
26 GpuPreference gpu_preference) { 26 GpuPreference gpu_preference) {
27 DCHECK(!context_) << "NSGLContext was previously initialized."; 27 DCHECK(!context_) << "NSGLContext was previously initialized.";
28 gpu_preference_ = gpu_preference; 28 gpu_preference_ = gpu_preference;
29 29
30 std::vector<NSOpenGLPixelFormatAttribute> attributes; 30 std::vector<NSOpenGLPixelFormatAttribute> attributes;
31 attributes.push_back(NSOpenGLPFAAccelerated); 31 attributes.push_back(NSOpenGLPFAAccelerated);
32 attributes.push_back(NSOpenGLPFADoubleBuffer); 32 attributes.push_back(NSOpenGLPFADoubleBuffer);
33 attributes.push_back(0); 33 attributes.push_back(0);
34 34
35 scoped_nsobject<NSOpenGLPixelFormat> pixel_format; 35 base::scoped_nsobject<NSOpenGLPixelFormat> pixel_format;
36 pixel_format.reset([[NSOpenGLPixelFormat alloc] 36 pixel_format.reset([[NSOpenGLPixelFormat alloc]
37 initWithAttributes:&attributes.front()]); 37 initWithAttributes:&attributes.front()]);
38 if (!pixel_format) { 38 if (!pixel_format) {
39 LOG(ERROR) << "NSOpenGLPixelFormat initWithAttributes failed."; 39 LOG(ERROR) << "NSOpenGLPixelFormat initWithAttributes failed.";
40 return false; 40 return false;
41 } 41 }
42 42
43 context_.reset([[NSOpenGLContext alloc] initWithFormat:pixel_format 43 context_.reset([[NSOpenGLContext alloc] initWithFormat:pixel_format
44 shareContext:nil]); 44 shareContext:nil]);
45 if (!context_) { 45 if (!context_) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 DCHECK(interval == 0 || interval == 1); 90 DCHECK(interval == 0 || interval == 1);
91 GLint swap = interval; 91 GLint swap = interval;
92 [context_ setValues:&swap forParameter:NSOpenGLCPSwapInterval]; 92 [context_ setValues:&swap forParameter:NSOpenGLCPSwapInterval];
93 } 93 }
94 94
95 void GLContextNSView::FlushBuffer() { 95 void GLContextNSView::FlushBuffer() {
96 [context_ flushBuffer]; 96 [context_ flushBuffer];
97 } 97 }
98 98
99 } // namespace gfx 99 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698