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

Side by Side Diff: ui/gfx/compositor/compositor_cc.cc

Issue 8463018: Use ScopedMakeCurrent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "" Created 9 years, 1 month 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
« no previous file with comments | « ui/gfx/compositor/compositor_cc.h ('k') | ui/gfx/compositor/compositor_gl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if (initialized_)
piman 2011/11/11 17:35:31 nit: Please keep the DCHECK here. ScopedResourcesC
jonathan.backer 2011/11/11 18:12:48 Done.
86 return context_->MakeCurrent(surface_.get()); 87 return new gfx::ScopedMakeCurrent(context_.get(), surface_.get());
88 else
89 return NULL;
87 } 90 }
88 91
89 void* SharedResourcesCC::GetDisplay() { 92 void* SharedResourcesCC::GetDisplay() {
90 return surface_->GetDisplay(); 93 return surface_->GetDisplay();
91 } 94 }
92 95
93 gfx::GLShareGroup* SharedResourcesCC::GetShareGroup() { 96 gfx::GLShareGroup* SharedResourcesCC::GetShareGroup() {
94 DCHECK(initialized_); 97 DCHECK(initialized_);
95 return context_->share_group(); 98 return context_->share_group();
96 } 99 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 ScheduleDraw(); 212 ScheduleDraw();
210 } 213 }
211 214
212 Compositor* Compositor::Create(CompositorDelegate* owner, 215 Compositor* Compositor::Create(CompositorDelegate* owner,
213 gfx::AcceleratedWidget widget, 216 gfx::AcceleratedWidget widget,
214 const gfx::Size& size) { 217 const gfx::Size& size) {
215 return new CompositorCC(owner, widget, size); 218 return new CompositorCC(owner, widget, size);
216 } 219 }
217 220
218 } // namespace ui 221 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/compositor/compositor_cc.h ('k') | ui/gfx/compositor/compositor_gl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698