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

Side by Side Diff: ui/compositor/test/in_process_context_factory.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: callback 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compositor/test/in_process_context_factory.h" 5 #include "ui/compositor/test/in_process_context_factory.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 << "If running tests, ensure that main() is calling " 95 << "If running tests, ensure that main() is calling "
96 << "gfx::GLSurfaceTestSupport::InitializeOneOff()"; 96 << "gfx::GLSurfaceTestSupport::InitializeOneOff()";
97 } 97 }
98 98
99 InProcessContextFactory::~InProcessContextFactory() { 99 InProcessContextFactory::~InProcessContextFactory() {
100 DCHECK(per_compositor_data_.empty()); 100 DCHECK(per_compositor_data_.empty());
101 } 101 }
102 102
103 void InProcessContextFactory::CreateOutputSurface( 103 void InProcessContextFactory::CreateOutputSurface(
104 base::WeakPtr<Compositor> compositor) { 104 base::WeakPtr<Compositor> compositor) {
105 gpu::gles2::ContextCreationAttribHelper attribs;
106 attribs.alpha_size = 8;
107 attribs.blue_size = 8;
108 attribs.green_size = 8;
109 attribs.red_size = 8;
110 attribs.depth_size = 0;
111 attribs.stencil_size = 0;
112 attribs.samples = 0;
113 attribs.sample_buffers = 0;
114 attribs.fail_if_major_perf_caveat = false;
115 attribs.bind_generates_resource = false;
116
117 scoped_refptr<InProcessContextProvider> context_provider =
118 InProcessContextProvider::Create(attribs, &gpu_memory_buffer_manager_,
119 &image_factory_,
120 compositor->widget(), "UICompositor");
121
122 // Try to reuse existing shared worker context provider. 105 // Try to reuse existing shared worker context provider.
123 bool shared_worker_context_provider_lost = false; 106 bool shared_worker_context_provider_lost = false;
124 if (shared_worker_context_provider_) { 107 if (shared_worker_context_provider_) {
125 // Note: If context is lost, delete reference after releasing the lock. 108 // Note: If context is lost, delete reference after releasing the lock.
126 base::AutoLock lock(*shared_worker_context_provider_->GetLock()); 109 base::AutoLock lock(*shared_worker_context_provider_->GetLock());
127 if (shared_worker_context_provider_->ContextGL() 110 if (shared_worker_context_provider_->ContextGL()
128 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { 111 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) {
129 shared_worker_context_provider_lost = true; 112 shared_worker_context_provider_lost = true;
130 } 113 }
131 } 114 }
132 if (!shared_worker_context_provider_ || shared_worker_context_provider_lost) { 115 if (!shared_worker_context_provider_ || shared_worker_context_provider_lost) {
133 shared_worker_context_provider_ = InProcessContextProvider::CreateOffscreen( 116 shared_worker_context_provider_ = InProcessContextProvider::CreateOffscreen(
134 &gpu_memory_buffer_manager_, &image_factory_); 117 &gpu_memory_buffer_manager_, &image_factory_, nullptr);
135 if (shared_worker_context_provider_ && 118 if (shared_worker_context_provider_ &&
136 !shared_worker_context_provider_->BindToCurrentThread()) 119 !shared_worker_context_provider_->BindToCurrentThread())
137 shared_worker_context_provider_ = nullptr; 120 shared_worker_context_provider_ = nullptr;
138 if (shared_worker_context_provider_) 121 if (shared_worker_context_provider_)
139 shared_worker_context_provider_->SetupLock(); 122 shared_worker_context_provider_->SetupLock();
140 } 123 }
141 124
125 gpu::gles2::ContextCreationAttribHelper attribs;
126 attribs.alpha_size = 8;
127 attribs.blue_size = 8;
128 attribs.green_size = 8;
129 attribs.red_size = 8;
130 attribs.depth_size = 0;
131 attribs.stencil_size = 0;
132 attribs.samples = 0;
133 attribs.sample_buffers = 0;
134 attribs.fail_if_major_perf_caveat = false;
135 attribs.bind_generates_resource = false;
136 scoped_refptr<InProcessContextProvider> context_provider =
137 InProcessContextProvider::Create(
138 attribs, shared_worker_context_provider_.get(),
139 &gpu_memory_buffer_manager_, &image_factory_, compositor->widget(),
140 "UICompositor");
141
142 scoped_ptr<cc::OutputSurface> real_output_surface; 142 scoped_ptr<cc::OutputSurface> real_output_surface;
143 143
144 if (use_test_surface_) { 144 if (use_test_surface_) {
145 bool flipped_output_surface = false; 145 bool flipped_output_surface = false;
146 real_output_surface = make_scoped_ptr(new cc::PixelTestOutputSurface( 146 real_output_surface = make_scoped_ptr(new cc::PixelTestOutputSurface(
147 context_provider, shared_worker_context_provider_, 147 context_provider, shared_worker_context_provider_,
148 flipped_output_surface)); 148 flipped_output_surface));
149 } else { 149 } else {
150 real_output_surface = make_scoped_ptr(new DirectOutputSurface( 150 real_output_surface = make_scoped_ptr(new DirectOutputSurface(
151 context_provider, shared_worker_context_provider_)); 151 context_provider, shared_worker_context_provider_));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 scoped_refptr<cc::ContextProvider> 185 scoped_refptr<cc::ContextProvider>
186 InProcessContextFactory::SharedMainThreadContextProvider() { 186 InProcessContextFactory::SharedMainThreadContextProvider() {
187 if (shared_main_thread_contexts_ && 187 if (shared_main_thread_contexts_ &&
188 shared_main_thread_contexts_->ContextGL()->GetGraphicsResetStatusKHR() == 188 shared_main_thread_contexts_->ContextGL()->GetGraphicsResetStatusKHR() ==
189 GL_NO_ERROR) 189 GL_NO_ERROR)
190 return shared_main_thread_contexts_; 190 return shared_main_thread_contexts_;
191 191
192 shared_main_thread_contexts_ = InProcessContextProvider::CreateOffscreen( 192 shared_main_thread_contexts_ = InProcessContextProvider::CreateOffscreen(
193 &gpu_memory_buffer_manager_, &image_factory_); 193 &gpu_memory_buffer_manager_, &image_factory_, nullptr);
piman 2016/04/07 00:26:06 Do we not need this to share with the other contex
danakj 2016/04/07 18:58:59 Everything is mailboxed (in our tests?) I don't th
194 if (shared_main_thread_contexts_.get() && 194 if (shared_main_thread_contexts_.get() &&
195 !shared_main_thread_contexts_->BindToCurrentThread()) 195 !shared_main_thread_contexts_->BindToCurrentThread())
196 shared_main_thread_contexts_ = NULL; 196 shared_main_thread_contexts_ = NULL;
197 197
198 return shared_main_thread_contexts_; 198 return shared_main_thread_contexts_;
199 } 199 }
200 200
201 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) { 201 void InProcessContextFactory::RemoveCompositor(Compositor* compositor) {
202 if (!per_compositor_data_.count(compositor)) 202 if (!per_compositor_data_.count(compositor))
203 return; 203 return;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 238 }
239 239
240 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, 240 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor,
241 const gfx::Size& size) { 241 const gfx::Size& size) {
242 if (!per_compositor_data_.count(compositor)) 242 if (!per_compositor_data_.count(compositor))
243 return; 243 return;
244 per_compositor_data_[compositor]->display()->Resize(size); 244 per_compositor_data_[compositor]->display()->Resize(size);
245 } 245 }
246 246
247 } // namespace ui 247 } // namespace ui
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.cc ('k') | ui/compositor/test/in_process_context_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698