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

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

Issue 2372593003: Iterative cleanup for GL programs in GPU process (Closed)
Patch Set: fix build Created 4 years, 3 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
« no previous file with comments | « gpu/command_buffer/service/program_manager.h ('k') | gpu/ipc/service/gpu_channel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f09417f2fdde20161fdfcc9bbb7d6a4bb083ea40 100644
--- a/gpu/command_buffer/service/program_manager.cc
+++ b/gpu/command_buffer/service/program_manager.cc
@@ -2482,6 +2482,23 @@ void ProgramManager::Destroy(bool have_context) {
programs_.clear();
}
+bool ProgramManager::PreDestroyWithTimeout(bool have_context,
+ const base::TimeTicks& timeout) {
+ have_context_ = have_context;
+ for (auto it = programs_.begin(); it != programs_.end();) {
+ if (it->second->InUse()) {
+ // Can't delete in-use programs.
+ ++it;
+ continue;
+ }
+ if (base::TimeTicks::Now() > timeout)
+ return false;
+
+ it = programs_.erase(it);
+ }
+ return true;
+}
+
void ProgramManager::StartTracking(Program* /* program */) {
++program_count_;
}
« no previous file with comments | « gpu/command_buffer/service/program_manager.h ('k') | gpu/ipc/service/gpu_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698