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

Unified Diff: gpu/command_buffer/service/program_manager.cc

Issue 2378583003: Ping watchdog thread during GpuChannel destruction (Closed)
Patch Set: Fix lifetime and use nullptr 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/program_manager.cc
diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc
index 754d5b0630b16d7d450787076dbbfbfd6b3fb257..5e9f13934bfd2b57b96358ae809388580d80bdc6 100644
--- a/gpu/command_buffer/service/program_manager.cc
+++ b/gpu/command_buffer/service/program_manager.cc
@@ -28,6 +28,7 @@
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/gpu_preferences.h"
#include "gpu/command_buffer/service/program_cache.h"
+#include "gpu/command_buffer/service/progress_reporter.h"
#include "gpu/command_buffer/service/shader_manager.h"
#include "third_party/re2/src/re2/re2.h"
#include "ui/gl/gl_version_info.h"
@@ -2452,14 +2453,14 @@ Program::~Program() {
}
}
-ProgramManager::ProgramManager(
- ProgramCache* program_cache,
- uint32_t max_varying_vectors,
- uint32_t max_draw_buffers,
- uint32_t max_dual_source_draw_buffers,
- uint32_t max_vertex_attribs,
- const GpuPreferences& gpu_preferences,
- FeatureInfo* feature_info)
+ProgramManager::ProgramManager(ProgramCache* program_cache,
+ uint32_t max_varying_vectors,
+ uint32_t max_draw_buffers,
+ uint32_t max_dual_source_draw_buffers,
+ uint32_t max_vertex_attribs,
+ const GpuPreferences& gpu_preferences,
+ FeatureInfo* feature_info,
+ ProgressReporter* progress_reporter)
: program_count_(0),
have_context_(true),
program_cache_(program_cache),
@@ -2468,7 +2469,8 @@ ProgramManager::ProgramManager(
max_dual_source_draw_buffers_(max_dual_source_draw_buffers),
max_vertex_attribs_(max_vertex_attribs),
gpu_preferences_(gpu_preferences),
- feature_info_(feature_info) {}
+ feature_info_(feature_info),
+ progress_reporter_(progress_reporter) {}
ProgramManager::~ProgramManager() {
DCHECK(programs_.empty());
@@ -2479,7 +2481,11 @@ void ProgramManager::Destroy(bool have_context) {
ProgramDeletionScopedUmaTimeAndRate scoped_histogram(
base::saturated_cast<int32_t>(programs_.size()));
- programs_.clear();
+ while (!programs_.empty()) {
+ programs_.erase(programs_.begin());
+ if (progress_reporter_)
+ progress_reporter_->ReportProgress();
+ }
}
void ProgramManager::StartTracking(Program* /* program */) {

Powered by Google App Engine
This is Rietveld 408576698