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

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

Issue 2132913002: Remove VirtualGLApi (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: extra cleanup Created 4 years, 5 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
« no previous file with comments | « no previous file | ui/gl/gl_context.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) 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 "base/callback.h" 7 #include "base/callback.h"
8 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" 8 #include "gpu/command_buffer/service/gl_state_restorer_impl.h"
9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
10 #include "ui/gl/gl_gl_api_implementation.h" 10 #include "ui/gl/gl_gl_api_implementation.h"
11 #include "ui/gl/gl_surface.h" 11 #include "ui/gl/gl_surface.h"
12 #include "ui/gl/gpu_preference.h" 12 #include "ui/gl/gpu_preference.h"
13 #include "ui/gl/gpu_timing.h" 13 #include "ui/gl/gpu_timing.h"
14 #include "ui/gl/scoped_api.h" 14 #include "ui/gl/scoped_api.h"
15 15
16 namespace gpu { 16 namespace gpu {
17 17
18 GLContextVirtual::GLContextVirtual(gl::GLShareGroup* share_group, 18 GLContextVirtual::GLContextVirtual(gl::GLShareGroup* share_group,
19 gl::GLContext* shared_context, 19 gl::GLContext* shared_context,
20 base::WeakPtr<gles2::GLES2Decoder> decoder) 20 base::WeakPtr<gles2::GLES2Decoder> decoder)
21 : GLContext(share_group), 21 : GLContext(share_group),
22 shared_context_(shared_context), 22 shared_context_(shared_context),
23 decoder_(decoder) {} 23 decoder_(decoder) {}
24 24
25 bool GLContextVirtual::Initialize(gl::GLSurface* compatible_surface, 25 bool GLContextVirtual::Initialize(gl::GLSurface* compatible_surface,
26 gl::GpuPreference gpu_preference) { 26 gl::GpuPreference gpu_preference) {
27 SetGLStateRestorer(new GLStateRestorerImpl(decoder_)); 27 SetGLStateRestorer(new GLStateRestorerImpl(decoder_));
28 28 return shared_context_->MakeVirtuallyCurrent(this, compatible_surface);
29 // Virtual contexts obviously can't make a context that is compatible
30 // with the surface (the context already exists), but we do need to
31 // make a context current for SetupForVirtualization() below.
32 if (!IsCurrent(compatible_surface)) {
33 if (!shared_context_->MakeCurrent(compatible_surface)) {
no sievers 2016/07/08 17:52:19 So this would potentially defer catching an incomp
piman 2016/07/08 18:30:58 MakeVirtuallyCurrent below will effectively call M
no sievers 2016/07/08 18:34:56 Ah you're right, since this here was using the sam
34 // This is likely an error. The real context should be made as
35 // compatible with all required surfaces when it was created.
36 LOG(ERROR) << "Failed MakeCurrent(compatible_surface)";
37 return false;
38 }
39 }
40
41 shared_context_->SetupForVirtualization();
42 shared_context_->MakeVirtuallyCurrent(this, compatible_surface);
43 return true;
44 } 29 }
45 30
46 void GLContextVirtual::Destroy() { 31 void GLContextVirtual::Destroy() {
47 shared_context_->OnReleaseVirtuallyCurrent(this); 32 shared_context_->OnReleaseVirtuallyCurrent(this);
48 shared_context_ = NULL; 33 shared_context_ = NULL;
49 } 34 }
50 35
51 bool GLContextVirtual::MakeCurrent(gl::GLSurface* surface) { 36 bool GLContextVirtual::MakeCurrent(gl::GLSurface* surface) {
52 if (decoder_.get()) 37 if (decoder_.get())
53 return shared_context_->MakeVirtuallyCurrent(this, surface); 38 return shared_context_->MakeVirtuallyCurrent(this, surface);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 91
107 gl::YUVToRGBConverter* GLContextVirtual::GetYUVToRGBConverter() { 92 gl::YUVToRGBConverter* GLContextVirtual::GetYUVToRGBConverter() {
108 return shared_context_->GetYUVToRGBConverter(); 93 return shared_context_->GetYUVToRGBConverter();
109 } 94 }
110 95
111 GLContextVirtual::~GLContextVirtual() { 96 GLContextVirtual::~GLContextVirtual() {
112 Destroy(); 97 Destroy();
113 } 98 }
114 99
115 } // namespace gpu 100 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | ui/gl/gl_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698