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

Unified Diff: gpu/command_buffer/client/program_info_manager.cc

Issue 613843003: Avoid holding locks across sync IPCs in command buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « no previous file | gpu/command_buffer/client/share_group.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/program_info_manager.cc
diff --git a/gpu/command_buffer/client/program_info_manager.cc b/gpu/command_buffer/client/program_info_manager.cc
index d854aa01f75065353e52a97b1adc91cef2a65e76..7f103416929f4165a2fe9f8160fd47d73b465ec5 100644
--- a/gpu/command_buffer/client/program_info_manager.cc
+++ b/gpu/command_buffer/client/program_info_manager.cc
@@ -195,7 +195,11 @@ class CachedProgramInfoManager : public ProgramInfoManager {
bool GetProgramiv(GLenum pname, GLint* params);
// Updates the program info after a successful link.
- void Update(GLES2Implementation* gl, GLuint program);
+ void Update(GLES2Implementation* gl,
+ GLuint program,
+ const std::vector<int8>& result);
+
+ bool cached() const { return cached_; }
private:
bool cached_;
@@ -316,12 +320,12 @@ template<typename T> static T LocalGetAs(
}
void CachedProgramInfoManager::Program::Update(
- GLES2Implementation* gl, GLuint program) {
+ GLES2Implementation* gl,
+ GLuint program,
+ const std::vector<int8>& result) {
if (cached_) {
return;
}
- std::vector<int8> result;
- gl->GetProgramInfoCHROMIUMHelper(program, &result);
if (result.empty()) {
// This should only happen on a lost context.
return;
@@ -389,7 +393,22 @@ CachedProgramInfoManager::Program*
return NULL;
}
Program* info = &it->second;
- info->Update(gl, program);
+ if (info->cached())
+ return info;
+ std::vector<int8> result;
+ {
+ base::AutoUnlock unlock(lock_);
+ // lock_ can't be held across IPC call or else it may deadlock in pepper.
+ // http://crbug.com/418651
+ gl->GetProgramInfoCHROMIUMHelper(program, &result);
+ }
+
+ it = program_infos_.find(program);
+ if (it == program_infos_.end()) {
+ return NULL;
+ }
+ info = &it->second;
+ info->Update(gl, program, result);
return info;
}
« no previous file with comments | « no previous file | gpu/command_buffer/client/share_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698