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

Side by Side Diff: components/mus/gles2/command_buffer_driver.cc

Issue 1716813002: Use GpuPreferences to avoid directly accessing switches in gpu related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/mus/gles2/command_buffer_driver.h" 5 #include "components/mus/gles2/command_buffer_driver.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return false; 104 return false;
105 105
106 if (!context_->MakeCurrent(surface_.get())) 106 if (!context_->MakeCurrent(surface_.get()))
107 return false; 107 return false;
108 108
109 // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but 109 // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but
110 // only needs to be per-thread. 110 // only needs to be per-thread.
111 const bool bind_generates_resource = attrib_helper.bind_generates_resource; 111 const bool bind_generates_resource = attrib_helper.bind_generates_resource;
112 scoped_refptr<gpu::gles2::ContextGroup> context_group = 112 scoped_refptr<gpu::gles2::ContextGroup> context_group =
113 new gpu::gles2::ContextGroup( 113 new gpu::gles2::ContextGroup(
114 gpu_state_->mailbox_manager(), new GpuMemoryTracker, 114 gpu_state_->gpu_preferences(), gpu_state_->mailbox_manager(),
115 new gpu::gles2::ShaderTranslatorCache, 115 new GpuMemoryTracker,
116 new gpu::gles2::ShaderTranslatorCache(gpu_state_->gpu_preferences()),
116 new gpu::gles2::FramebufferCompletenessCache, nullptr, nullptr, 117 new gpu::gles2::FramebufferCompletenessCache, nullptr, nullptr,
117 nullptr, bind_generates_resource); 118 nullptr, bind_generates_resource);
118 119
119 command_buffer_.reset( 120 command_buffer_.reset(
120 new gpu::CommandBufferService(context_group->transfer_buffer_manager())); 121 new gpu::CommandBufferService(context_group->transfer_buffer_manager()));
121 bool result = command_buffer_->Initialize(); 122 bool result = command_buffer_->Initialize();
122 DCHECK(result); 123 DCHECK(result);
123 124
124 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get())); 125 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get()));
125 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(), 126 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(),
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 492
492 gpu::gles2::QueryManager* query_manager = decoder_->GetQueryManager(); 493 gpu::gles2::QueryManager* query_manager = decoder_->GetQueryManager();
493 gpu::gles2::QueryManager::Query* query = query_manager->GetQuery(query_id); 494 gpu::gles2::QueryManager::Query* query = query_manager->GetQuery(query_id);
494 if (query) 495 if (query)
495 query->AddCallback(callback); 496 query->AddCallback(callback);
496 else 497 else
497 callback.Run(); 498 callback.Run();
498 } 499 }
499 500
500 } // namespace mus 501 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698