Chromium Code Reviews| Index: gpu/command_buffer/service/context_group.cc |
| diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc |
| index eaaa0142da9c1ea236147c97cc18a5edcdbafce9..29a0823397d8ae93b439b2f1660c373155cd6365 100644 |
| --- a/gpu/command_buffer/service/context_group.cc |
| +++ b/gpu/command_buffer/service/context_group.cc |
| @@ -18,6 +18,7 @@ |
| #include "gpu/command_buffer/service/mailbox_manager_impl.h" |
| #include "gpu/command_buffer/service/path_manager.h" |
| #include "gpu/command_buffer/service/program_manager.h" |
| +#include "gpu/command_buffer/service/progress_reporter.h" |
| #include "gpu/command_buffer/service/renderbuffer_manager.h" |
| #include "gpu/command_buffer/service/sampler_manager.h" |
| #include "gpu/command_buffer/service/shader_manager.h" |
| @@ -65,7 +66,8 @@ ContextGroup::ContextGroup( |
| framebuffer_completeness_cache, |
| const scoped_refptr<FeatureInfo>& feature_info, |
| bool bind_generates_resource, |
| - gpu::ImageFactory* image_factory) |
| + gpu::ImageFactory* image_factory, |
| + std::unique_ptr<ProgressReporter> progress_reporter) |
| : gpu_preferences_(gpu_preferences), |
| mailbox_manager_(mailbox_manager), |
| memory_tracker_(memory_tracker), |
| @@ -103,6 +105,7 @@ ContextGroup::ContextGroup( |
| program_cache_(NULL), |
| feature_info_(feature_info), |
| image_factory_(image_factory), |
| + progress_reporter_(std::move(progress_reporter)), |
| passthrough_resources_(new PassthroughResources) { |
| { |
| DCHECK(feature_info_); |
| @@ -481,6 +484,11 @@ bool ContextGroup::HaveContexts() { |
| return !decoders_.empty(); |
| } |
| +void ContextGroup::ReportProgress() { |
| + if (progress_reporter_) |
| + progress_reporter_->ReportProgress(); |
| +} |
| + |
| void ContextGroup::Destroy(GLES2Decoder* decoder, bool have_context) { |
| decoders_.erase(std::remove_if(decoders_.begin(), decoders_.end(), |
| WeakPtrEquals<gles2::GLES2Decoder>(decoder)), |
| @@ -496,6 +504,7 @@ void ContextGroup::Destroy(GLES2Decoder* decoder, bool have_context) { |
| } |
| buffer_manager_->Destroy(); |
| buffer_manager_.reset(); |
| + ReportProgress(); |
|
ericrk
2016/09/30 05:09:07
Not sure if I'm too trigger happy with ReportProgr
|
| } |
| if (framebuffer_manager_ != NULL) { |
| @@ -503,42 +512,50 @@ void ContextGroup::Destroy(GLES2Decoder* decoder, bool have_context) { |
| if (texture_manager_) |
| texture_manager_->set_framebuffer_manager(NULL); |
| framebuffer_manager_.reset(); |
| + ReportProgress(); |
| } |
| if (renderbuffer_manager_ != NULL) { |
| renderbuffer_manager_->Destroy(have_context); |
| renderbuffer_manager_.reset(); |
| + ReportProgress(); |
| } |
| if (texture_manager_ != NULL) { |
| - texture_manager_->Destroy(have_context); |
| + texture_manager_->Destroy(have_context, progress_reporter_.get()); |
| texture_manager_.reset(); |
| + ReportProgress(); |
| } |
| if (path_manager_ != NULL) { |
| path_manager_->Destroy(have_context); |
| path_manager_.reset(); |
| + ReportProgress(); |
| } |
| if (program_manager_ != NULL) { |
| - program_manager_->Destroy(have_context); |
| + program_manager_->Destroy(have_context, progress_reporter_.get()); |
| program_manager_.reset(); |
| + ReportProgress(); |
| } |
| if (shader_manager_ != NULL) { |
| - shader_manager_->Destroy(have_context); |
| + shader_manager_->Destroy(have_context, progress_reporter_.get()); |
| shader_manager_.reset(); |
| + ReportProgress(); |
| } |
| if (sampler_manager_ != NULL) { |
| sampler_manager_->Destroy(have_context); |
| sampler_manager_.reset(); |
| + ReportProgress(); |
| } |
| memory_tracker_ = NULL; |
| passthrough_resources_->Destroy(have_context); |
| passthrough_resources_.reset(); |
| + ReportProgress(); |
| } |
| uint32_t ContextGroup::GetMemRepresented() const { |