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

Side by Side Diff: gpu/command_buffer/service/gl_context_virtual.cc

Issue 15925007: Virtual context MakeCurrent tweaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: keep explicit surface ref release Created 7 years, 6 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
« no previous file with comments | « content/common/gpu/image_transport_surface_mac.cc ('k') | no next file » | 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) 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 "gpu/command_buffer/service/gl_context_virtual.h" 5 #include "gpu/command_buffer/service/gl_context_virtual.h"
6 6
7 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" 7 #include "gpu/command_buffer/service/gl_state_restorer_impl.h"
8 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 8 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
9 #include "ui/gl/gl_surface.h" 9 #include "ui/gl/gl_surface.h"
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return true; 47 return true;
48 } 48 }
49 49
50 void GLContextVirtual::Destroy() { 50 void GLContextVirtual::Destroy() {
51 shared_context_->OnReleaseVirtuallyCurrent(this); 51 shared_context_->OnReleaseVirtuallyCurrent(this);
52 shared_context_ = NULL; 52 shared_context_ = NULL;
53 display_ = NULL; 53 display_ = NULL;
54 } 54 }
55 55
56 bool GLContextVirtual::MakeCurrent(gfx::GLSurface* surface) { 56 bool GLContextVirtual::MakeCurrent(gfx::GLSurface* surface) {
57 // TODO(epenner): We should avoid bypassing MakeVirtuallyCurrent() below
58 // (return false or DCHECK when !decoder). To do this we must reorder
59 // tear-down in GpuCommandBufferStub::Destroy().
60 if (decoder_.get()) 57 if (decoder_.get())
61 shared_context_->MakeVirtuallyCurrent(this, surface); 58 return shared_context_->MakeVirtuallyCurrent(this, surface);
62 else if (!IsCurrent(surface)) 59
63 shared_context_->MakeCurrent(surface); 60 LOG(ERROR) << "Trying to make virtual context current without decoder.";
64 return true; 61 return false;
65 } 62 }
66 63
67 void GLContextVirtual::ReleaseCurrent(gfx::GLSurface* surface) { 64 void GLContextVirtual::ReleaseCurrent(gfx::GLSurface* surface) {
68 if (IsCurrent(surface)) { 65 if (IsCurrent(surface)) {
69 shared_context_->OnReleaseVirtuallyCurrent(this); 66 shared_context_->OnReleaseVirtuallyCurrent(this);
70 shared_context_->ReleaseCurrent(surface); 67 shared_context_->ReleaseCurrent(surface);
71 } 68 }
72 } 69 }
73 70
74 bool GLContextVirtual::IsCurrent(gfx::GLSurface* surface) { 71 bool GLContextVirtual::IsCurrent(gfx::GLSurface* surface) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 108
112 void GLContextVirtual::SetUnbindFboOnMakeCurrent() { 109 void GLContextVirtual::SetUnbindFboOnMakeCurrent() {
113 shared_context_->SetUnbindFboOnMakeCurrent(); 110 shared_context_->SetUnbindFboOnMakeCurrent();
114 } 111 }
115 112
116 GLContextVirtual::~GLContextVirtual() { 113 GLContextVirtual::~GLContextVirtual() {
117 Destroy(); 114 Destroy();
118 } 115 }
119 116
120 } // namespace gpu 117 } // namespace gpu
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698