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 "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" | 7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" |
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" |
10 #include "ui/gfx/compositor/layer.h" | 10 #include "ui/gfx/compositor/layer.h" |
11 #include "ui/gfx/gl/gl_context.h" | 11 #include "ui/gfx/gl/gl_context.h" |
12 #include "ui/gfx/gl/gl_surface.h" | 12 #include "ui/gfx/gl/gl_surface.h" |
13 #include "ui/gfx/gl/gl_implementation.h" | 13 #include "ui/gfx/gl/gl_implementation.h" |
| 14 #include "ui/gfx/gl/scoped_make_current.h" |
14 #include "webkit/glue/webthread_impl.h" | 15 #include "webkit/glue/webthread_impl.h" |
15 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 16 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 webkit_glue::WebThreadImpl* g_compositor_thread = NULL; | 19 webkit_glue::WebThreadImpl* g_compositor_thread = NULL; |
19 } // anonymous namespace | 20 } // anonymous namespace |
20 | 21 |
21 namespace ui { | 22 namespace ui { |
22 | 23 |
23 SharedResourcesCC::SharedResourcesCC() : initialized_(false) { | 24 SharedResourcesCC::SharedResourcesCC() : initialized_(false) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return true; | 75 return true; |
75 } | 76 } |
76 | 77 |
77 void SharedResourcesCC::Destroy() { | 78 void SharedResourcesCC::Destroy() { |
78 context_ = NULL; | 79 context_ = NULL; |
79 surface_ = NULL; | 80 surface_ = NULL; |
80 | 81 |
81 initialized_ = false; | 82 initialized_ = false; |
82 } | 83 } |
83 | 84 |
84 bool SharedResourcesCC::MakeSharedContextCurrent() { | 85 gfx::ScopedMakeCurrent* SharedResourcesCC::GetScopedMakeCurrent() { |
85 DCHECK(initialized_); | 86 DCHECK(initialized_); |
86 return context_->MakeCurrent(surface_.get()); | 87 if (initialized_) |
| 88 return new gfx::ScopedMakeCurrent(context_.get(), surface_.get()); |
| 89 else |
| 90 return NULL; |
87 } | 91 } |
88 | 92 |
89 void* SharedResourcesCC::GetDisplay() { | 93 void* SharedResourcesCC::GetDisplay() { |
90 return surface_->GetDisplay(); | 94 return surface_->GetDisplay(); |
91 } | 95 } |
92 | 96 |
93 gfx::GLShareGroup* SharedResourcesCC::GetShareGroup() { | 97 gfx::GLShareGroup* SharedResourcesCC::GetShareGroup() { |
94 DCHECK(initialized_); | 98 DCHECK(initialized_); |
95 return context_->share_group(); | 99 return context_->share_group(); |
96 } | 100 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 ScheduleDraw(); | 213 ScheduleDraw(); |
210 } | 214 } |
211 | 215 |
212 Compositor* Compositor::Create(CompositorDelegate* owner, | 216 Compositor* Compositor::Create(CompositorDelegate* owner, |
213 gfx::AcceleratedWidget widget, | 217 gfx::AcceleratedWidget widget, |
214 const gfx::Size& size) { | 218 const gfx::Size& size) { |
215 return new CompositorCC(owner, widget, size); | 219 return new CompositorCC(owner, widget, size); |
216 } | 220 } |
217 | 221 |
218 } // namespace ui | 222 } // namespace ui |
OLD | NEW |