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

Side by Side Diff: gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.cc

Issue 1864373002: Remove unused features for in-process GL contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: inproclost: allthethings Created 4 years, 8 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
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/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" 5 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <utility> 8 #include <utility>
9 #ifndef GL_GLEXT_PROTOTYPES 9 #ifndef GL_GLEXT_PROTOTYPES
10 #define GL_GLEXT_PROTOTYPES 1 10 #define GL_GLEXT_PROTOTYPES 1
(...skipping 16 matching lines...) Expand all
27 #include "ui/gl/gl_implementation.h" 27 #include "ui/gl/gl_implementation.h"
28 28
29 using gpu::gles2::GLES2Implementation; 29 using gpu::gles2::GLES2Implementation;
30 using gpu::GLInProcessContext; 30 using gpu::GLInProcessContext;
31 31
32 namespace gpu_blink { 32 namespace gpu_blink {
33 33
34 // static 34 // static
35 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 35 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
36 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( 36 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
37 const gpu::gles2::ContextCreationAttribHelper& attributes, 37 const gpu::gles2::ContextCreationAttribHelper& attributes) {
38 bool share_resources) {
39 bool is_offscreen = true; 38 bool is_offscreen = true;
40 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( 39 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
41 scoped_ptr<::gpu::GLInProcessContext>(), attributes, share_resources, 40 scoped_ptr<::gpu::GLInProcessContext>(), attributes, is_offscreen,
42 is_offscreen, gfx::kNullAcceleratedWidget)); 41 gfx::kNullAcceleratedWidget));
43 } 42 }
44 43
45 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 44 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
46 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( 45 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext(
47 scoped_ptr<::gpu::GLInProcessContext> context, 46 scoped_ptr<::gpu::GLInProcessContext> context,
48 const gpu::gles2::ContextCreationAttribHelper& attributes) { 47 const gpu::gles2::ContextCreationAttribHelper& attributes) {
49 bool is_offscreen = true; // Not used. 48 bool is_offscreen = true; // Not used.
50 bool share_resources = false; // Not used.
51 gfx::AcceleratedWidget window = gfx::kNullAcceleratedWidget; // Not used. 49 gfx::AcceleratedWidget window = gfx::kNullAcceleratedWidget; // Not used.
52 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( 50 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
53 std::move(context), attributes, share_resources, is_offscreen, window)); 51 std::move(context), attributes, is_offscreen, window));
54 } 52 }
55 53
56 WebGraphicsContext3DInProcessCommandBufferImpl:: 54 WebGraphicsContext3DInProcessCommandBufferImpl::
57 WebGraphicsContext3DInProcessCommandBufferImpl( 55 WebGraphicsContext3DInProcessCommandBufferImpl(
58 scoped_ptr<::gpu::GLInProcessContext> context, 56 scoped_ptr<::gpu::GLInProcessContext> context,
59 const gpu::gles2::ContextCreationAttribHelper& attributes, 57 const gpu::gles2::ContextCreationAttribHelper& attributes,
60 bool share_resources,
61 bool is_offscreen, 58 bool is_offscreen,
62 gfx::AcceleratedWidget window) 59 gfx::AcceleratedWidget window)
63 : attributes_(attributes), 60 : attributes_(attributes),
64 share_resources_(share_resources),
65 is_offscreen_(is_offscreen), 61 is_offscreen_(is_offscreen),
66 window_(window), 62 window_(window),
67 context_(std::move(context)) {} 63 context_(std::move(context)) {}
68 64
69 WebGraphicsContext3DInProcessCommandBufferImpl:: 65 WebGraphicsContext3DInProcessCommandBufferImpl::
70 ~WebGraphicsContext3DInProcessCommandBufferImpl() { 66 ~WebGraphicsContext3DInProcessCommandBufferImpl() {
71 } 67 }
72 68
73 size_t WebGraphicsContext3DInProcessCommandBufferImpl::GetMappedMemoryLimit() { 69 size_t WebGraphicsContext3DInProcessCommandBufferImpl::GetMappedMemoryLimit() {
74 return context_->GetMappedMemoryLimit(); 70 return context_->GetMappedMemoryLimit();
(...skipping 10 matching lines...) Expand all
85 // TODO(kbr): More work will be needed in this implementation to 81 // TODO(kbr): More work will be needed in this implementation to
86 // properly support GPU switching. Like in the out-of-process 82 // properly support GPU switching. Like in the out-of-process
87 // command buffer implementation, all previously created contexts 83 // command buffer implementation, all previously created contexts
88 // will need to be lost either when the first context requesting the 84 // will need to be lost either when the first context requesting the
89 // discrete GPU is created, or the last one is destroyed. 85 // discrete GPU is created, or the last one is destroyed.
90 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; 86 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
91 context_.reset(GLInProcessContext::Create( 87 context_.reset(GLInProcessContext::Create(
92 NULL, /* service */ 88 NULL, /* service */
93 NULL, /* surface */ 89 NULL, /* surface */
94 is_offscreen_, window_, gfx::Size(1, 1), NULL, /* share_context */ 90 is_offscreen_, window_, gfx::Size(1, 1), NULL, /* share_context */
95 share_resources_, attributes_, gpu_preference, 91 attributes_, gpu_preference,
96 ::gpu::GLInProcessContextSharedMemoryLimits(), nullptr, nullptr)); 92 ::gpu::GLInProcessContextSharedMemoryLimits(), nullptr, nullptr));
97 } 93 }
98 94
99 if (context_) { 95 if (!context_) {
100 base::Closure context_lost_callback = base::Bind(
101 &WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost,
102 base::Unretained(this));
103 context_->SetContextLostCallback(context_lost_callback);
104 } else {
105 initialize_failed_ = true; 96 initialize_failed_ = true;
106 return false; 97 return false;
107 } 98 }
108 99
109 real_gl_ = context_->GetImplementation(); 100 real_gl_ = context_->GetImplementation();
110 SetGLInterface(real_gl_); 101 SetGLInterface(real_gl_);
111 102
112 real_gl_->TraceBeginCHROMIUM("WebGraphicsContext3D", 103 real_gl_->TraceBeginCHROMIUM("WebGraphicsContext3D",
113 "InProcessContext"); 104 "InProcessContext");
114 105
(...skipping 12 matching lines...) Expand all
127 118
128 void WebGraphicsContext3DInProcessCommandBufferImpl::SetLock(base::Lock* lock) { 119 void WebGraphicsContext3DInProcessCommandBufferImpl::SetLock(base::Lock* lock) {
129 context_->SetLock(lock); 120 context_->SetLock(lock);
130 } 121 }
131 122
132 ::gpu::ContextSupport* 123 ::gpu::ContextSupport*
133 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() { 124 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() {
134 return real_gl_; 125 return real_gl_;
135 } 126 }
136 127
137 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() {
138 if (context_lost_callback_) {
139 context_lost_callback_->onContextLost();
140 }
141 }
142
143 } // namespace gpu_blink 128 } // namespace gpu_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698