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

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

Issue 2378583003: Ping watchdog thread during GpuChannel destruction (Closed)
Patch Set: remove throttling Created 4 years, 2 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/command_buffer/service/shader_manager.h" 5 #include "gpu/command_buffer/service/shader_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "gpu/command_buffer/service/progress_reporter.h"
13 14
14 namespace gpu { 15 namespace gpu {
15 namespace gles2 { 16 namespace gles2 {
16 17
17 namespace { 18 namespace {
18 19
19 // Given a variable name | a[0].b.c[0] |, return |a|. 20 // Given a variable name | a[0].b.c[0] |, return |a|.
20 std::string GetTopVariableName(const std::string& fullname) { 21 std::string GetTopVariableName(const std::string& fullname) {
21 size_t pos = fullname.find_first_of("[."); 22 size_t pos = fullname.find_first_of("[.");
22 if (pos == std::string::npos) 23 if (pos == std::string::npos)
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 267 }
267 return nullptr; 268 return nullptr;
268 } 269 }
269 270
270 ShaderManager::ShaderManager() {} 271 ShaderManager::ShaderManager() {}
271 272
272 ShaderManager::~ShaderManager() { 273 ShaderManager::~ShaderManager() {
273 DCHECK(shaders_.empty()); 274 DCHECK(shaders_.empty());
274 } 275 }
275 276
276 void ShaderManager::Destroy(bool have_context) { 277 void ShaderManager::Destroy(bool have_context,
278 ProgressReporter* progress_reporter) {
277 while (!shaders_.empty()) { 279 while (!shaders_.empty()) {
278 if (have_context) { 280 if (have_context) {
279 Shader* shader = shaders_.begin()->second.get(); 281 Shader* shader = shaders_.begin()->second.get();
280 shader->Destroy(); 282 shader->Destroy();
281 } 283 }
282 shaders_.erase(shaders_.begin()); 284 shaders_.erase(shaders_.begin());
285 if (progress_reporter)
danakj 2016/10/05 01:53:48 same, when is it null?
ericrk 2016/10/05 18:07:31 removed.
286 progress_reporter->ReportProgress();
283 } 287 }
284 } 288 }
285 289
286 Shader* ShaderManager::CreateShader( 290 Shader* ShaderManager::CreateShader(
287 GLuint client_id, 291 GLuint client_id,
288 GLuint service_id, 292 GLuint service_id,
289 GLenum shader_type) { 293 GLenum shader_type) {
290 std::pair<ShaderMap::iterator, bool> result = 294 std::pair<ShaderMap::iterator, bool> result =
291 shaders_.insert(std::make_pair( 295 shaders_.insert(std::make_pair(
292 client_id, scoped_refptr<Shader>( 296 client_id, scoped_refptr<Shader>(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 356
353 void ShaderManager::UnuseShader(Shader* shader) { 357 void ShaderManager::UnuseShader(Shader* shader) {
354 DCHECK(shader); 358 DCHECK(shader);
355 DCHECK(IsOwned(shader)); 359 DCHECK(IsOwned(shader));
356 shader->DecUseCount(); 360 shader->DecUseCount();
357 RemoveShader(shader); 361 RemoveShader(shader);
358 } 362 }
359 363
360 } // namespace gles2 364 } // namespace gles2
361 } // namespace gpu 365 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698