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

Side by Side Diff: gpu/command_buffer/tests/gl_manager.cc

Issue 20017005: gpu: Refactor GpuMemoryBuffer framework for multi-process support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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/tests/gl_manager.h" 5 #include "gpu/command_buffer/tests/gl_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 20 matching lines...) Expand all
31 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_; 31 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_;
32 scoped_refptr<gfx::GLContext>* GLManager::base_context_; 32 scoped_refptr<gfx::GLContext>* GLManager::base_context_;
33 33
34 GLManager::Options::Options() 34 GLManager::Options::Options()
35 : size(4, 4), 35 : size(4, 4),
36 share_group_manager(NULL), 36 share_group_manager(NULL),
37 share_mailbox_manager(NULL), 37 share_mailbox_manager(NULL),
38 virtual_manager(NULL), 38 virtual_manager(NULL),
39 bind_generates_resource(false), 39 bind_generates_resource(false),
40 context_lost_allowed(false), 40 context_lost_allowed(false),
41 image_manager(NULL), 41 image_manager(NULL) {
42 image_factory(NULL) {
43 } 42 }
44 43
45 GLManager::GLManager() 44 GLManager::GLManager()
46 : context_lost_allowed_(false) { 45 : context_lost_allowed_(false) {
47 SetupBaseContext(); 46 SetupBaseContext();
48 } 47 }
49 48
50 GLManager::~GLManager() { 49 GLManager::~GLManager() {
51 --use_count_; 50 --use_count_;
52 if (!use_count_) { 51 if (!use_count_) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 if (!context_group) { 131 if (!context_group) {
133 context_group = new gles2::ContextGroup(mailbox_manager_.get(), 132 context_group = new gles2::ContextGroup(mailbox_manager_.get(),
134 options.image_manager, 133 options.image_manager,
135 NULL, 134 NULL,
136 NULL, 135 NULL,
137 options.bind_generates_resource); 136 options.bind_generates_resource);
138 } 137 }
139 138
140 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); 139 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group));
141 140
142 command_buffer_.reset(new CommandBufferService( 141 command_buffer_.reset(
143 decoder_->GetContextGroup()->transfer_buffer_manager())); 142 new CommandBufferService(
143 decoder_->GetContextGroup()->transfer_buffer_manager(),
144 decoder_->GetContextGroup()->image_manager(),
145 options.gpu_memory_buffer_factory));
144 ASSERT_TRUE(command_buffer_->Initialize()) 146 ASSERT_TRUE(command_buffer_->Initialize())
145 << "could not create command buffer service"; 147 << "could not create command buffer service";
146 148
147 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(), 149 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(),
148 decoder_.get(), 150 decoder_.get(),
149 decoder_.get())); 151 decoder_.get()));
150 152
151 decoder_->set_engine(gpu_scheduler_.get()); 153 decoder_->set_engine(gpu_scheduler_.get());
152 154
153 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(options.size); 155 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(options.size);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 196
195 // Create a transfer buffer. 197 // Create a transfer buffer.
196 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); 198 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get()));
197 199
198 // Create the object exposing the OpenGL API. 200 // Create the object exposing the OpenGL API.
199 gles2_implementation_.reset(new gles2::GLES2Implementation( 201 gles2_implementation_.reset(new gles2::GLES2Implementation(
200 gles2_helper_.get(), 202 gles2_helper_.get(),
201 client_share_group, 203 client_share_group,
202 transfer_buffer_.get(), 204 transfer_buffer_.get(),
203 kShareResources, 205 kShareResources,
204 options.bind_generates_resource, 206 options.bind_generates_resource));
205 options.image_factory));
206 207
207 ASSERT_TRUE(gles2_implementation_->Initialize( 208 ASSERT_TRUE(gles2_implementation_->Initialize(
208 kStartTransferBufferSize, 209 kStartTransferBufferSize,
209 kMinTransferBufferSize, 210 kMinTransferBufferSize,
210 kMaxTransferBufferSize)) << "Could not init GLES2Implementation"; 211 kMaxTransferBufferSize)) << "Could not init GLES2Implementation";
211 212
212 MakeCurrent(); 213 MakeCurrent();
213 } 214 }
214 215
215 void GLManager::SetupBaseContext() { 216 void GLManager::SetupBaseContext() {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 if (!context_lost_allowed_) { 267 if (!context_lost_allowed_) {
267 ASSERT_EQ(::gpu::error::kNoError, state.error); 268 ASSERT_EQ(::gpu::error::kNoError, state.error);
268 } 269 }
269 } 270 }
270 271
271 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { 272 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) {
272 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); 273 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id);
273 } 274 }
274 275
275 } // namespace gpu 276 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698