OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/compositor/compositor_cc.h" | 5 #include "ui/gfx/compositor/compositor_cc.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "third_party/skia/include/images/SkImageEncoder.h" | 8 #include "third_party/skia/include/images/SkImageEncoder.h" |
9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 gfx::GLShareGroup* share_group = | 232 gfx::GLShareGroup* share_group = |
233 SharedResourcesCC::GetInstance()->GetShareGroup(); | 233 SharedResourcesCC::GetInstance()->GetShareGroup(); |
234 WebKit::WebGraphicsContext3D* context = | 234 WebKit::WebGraphicsContext3D* context = |
235 new webkit::gpu::WebGraphicsContext3DInProcessImpl(widget_, share_group); | 235 new webkit::gpu::WebGraphicsContext3DInProcessImpl(widget_, share_group); |
236 WebKit::WebGraphicsContext3D::Attributes attrs; | 236 WebKit::WebGraphicsContext3D::Attributes attrs; |
237 context->initialize(attrs, 0, true); | 237 context->initialize(attrs, 0, true); |
238 | 238 |
239 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 239 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
240 if (!command_line->HasSwitch(switches::kDisableUIVsync)) { | 240 if (!command_line->HasSwitch(switches::kDisableUIVsync)) { |
241 context->makeContextCurrent(); | 241 context->makeContextCurrent(); |
242 gfx::GLContext::GetCurrent()->SetSwapInterval(1); | 242 gfx::GLContext* gl_context = gfx::GLContext::GetCurrent(); |
| 243 gl_context->SetSwapInterval(1); |
| 244 gl_context->ReleaseCurrent(NULL); |
243 } | 245 } |
244 | 246 |
245 return context; | 247 return context; |
246 } | 248 } |
247 | 249 |
248 void CompositorCC::didRebindGraphicsContext(bool success) { | 250 void CompositorCC::didRebindGraphicsContext(bool success) { |
249 } | 251 } |
250 | 252 |
251 void CompositorCC::scheduleComposite() { | 253 void CompositorCC::scheduleComposite() { |
252 ScheduleDraw(); | 254 ScheduleDraw(); |
253 } | 255 } |
254 | 256 |
255 void CompositorCC::notifyNeedsComposite() { | 257 void CompositorCC::notifyNeedsComposite() { |
256 ScheduleDraw(); | 258 ScheduleDraw(); |
257 } | 259 } |
258 | 260 |
259 Compositor* Compositor::Create(CompositorDelegate* owner, | 261 Compositor* Compositor::Create(CompositorDelegate* owner, |
260 gfx::AcceleratedWidget widget, | 262 gfx::AcceleratedWidget widget, |
261 const gfx::Size& size) { | 263 const gfx::Size& size) { |
262 return new CompositorCC(owner, widget, size); | 264 return new CompositorCC(owner, widget, size); |
263 } | 265 } |
264 | 266 |
265 } // namespace ui | 267 } // namespace ui |
OLD | NEW |