OLD | NEW |
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_surface_nsview.h" | 5 #include "ui/gl/gl_surface_nsview.h" |
6 | 6 |
7 #import <AppKit/NSOpenGL.h> | 7 #import <AppKit/NSOpenGL.h> |
8 #import <AppKit/NSView.h> | 8 #import <AppKit/NSView.h> |
9 | 9 |
| 10 #include "base/debug/trace_event.h" |
10 #include "ui/gl/gl_context_nsview.h" | 11 #include "ui/gl/gl_context_nsview.h" |
11 | 12 |
12 namespace gfx { | 13 namespace gfx { |
13 | 14 |
14 GLSurfaceNSView::GLSurfaceNSView(AcceleratedWidget view) | 15 GLSurfaceNSView::GLSurfaceNSView(AcceleratedWidget view) |
15 : view_(view), | 16 : view_(view), |
16 context_(NULL) { | 17 context_(NULL) { |
17 } | 18 } |
18 | 19 |
19 GLSurfaceNSView::~GLSurfaceNSView() { | 20 GLSurfaceNSView::~GLSurfaceNSView() { |
20 } | 21 } |
21 | 22 |
22 void GLSurfaceNSView::Destroy() { | 23 void GLSurfaceNSView::Destroy() { |
23 } | 24 } |
24 | 25 |
25 bool GLSurfaceNSView::IsOffscreen() { | 26 bool GLSurfaceNSView::IsOffscreen() { |
26 return false; | 27 return false; |
27 } | 28 } |
28 | 29 |
29 bool GLSurfaceNSView::SwapBuffers() { | 30 bool GLSurfaceNSView::SwapBuffers() { |
| 31 TRACE_EVENT2("gpu", "GLSurfaceNSView:RealSwapBuffers", |
| 32 "width", GetSize().width(), |
| 33 "height", GetSize().height()); |
30 context_->FlushBuffer(); | 34 context_->FlushBuffer(); |
31 return true; | 35 return true; |
32 } | 36 } |
33 | 37 |
34 gfx::Size GLSurfaceNSView::GetSize() { | 38 gfx::Size GLSurfaceNSView::GetSize() { |
35 return gfx::Size(NSSizeToCGSize([view_ bounds].size)); | 39 return gfx::Size(NSSizeToCGSize([view_ bounds].size)); |
36 } | 40 } |
37 | 41 |
38 void* GLSurfaceNSView::GetHandle() { | 42 void* GLSurfaceNSView::GetHandle() { |
39 return view_; | 43 return view_; |
40 } | 44 } |
41 | 45 |
42 bool GLSurfaceNSView::OnMakeCurrent(GLContext* context) { | 46 bool GLSurfaceNSView::OnMakeCurrent(GLContext* context) { |
43 context_ = static_cast<GLContextNSView *>(context); | 47 context_ = static_cast<GLContextNSView *>(context); |
44 return true; | 48 return true; |
45 } | 49 } |
46 | 50 |
47 } // namespace gfx | 51 } // namespace gfx |
OLD | NEW |