| Index: cc/output/gl_renderer.cc
|
| diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
|
| index 8e60f944d4f6f23cf033f15f2f7c619473fe99cf..df3ddfd3b9e865906172309006e8e45d91ded448 100644
|
| --- a/cc/output/gl_renderer.cc
|
| +++ b/cc/output/gl_renderer.cc
|
| @@ -175,6 +175,10 @@ SamplerType SamplerTypeFromTextureTarget(GLenum target) {
|
| // determine when anti-aliasing is unnecessary.
|
| const float kAntiAliasingEpsilon = 1.0f / 1024.0f;
|
|
|
| +// Block or crash if the number of pending sync queries reach this high as
|
| +// something is seriously wrong on the service side if this happens.
|
| +const size_t kMaxPendingSyncQueries = 16;
|
| +
|
| } // anonymous namespace
|
|
|
| class GLRenderer::ScopedUseGrContext {
|
| @@ -248,6 +252,11 @@ class GLRenderer::SyncQuery {
|
| return !available;
|
| }
|
|
|
| + void Wait() {
|
| + unsigned result = 0;
|
| + gl_->GetQueryObjectuivEXT(query_id_, GL_QUERY_RESULT_EXT, &result);
|
| + }
|
| +
|
| private:
|
| class Fence : public ResourceProvider::Fence {
|
| public:
|
| @@ -441,6 +450,15 @@ void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) {
|
|
|
| scoped_refptr<ResourceProvider::Fence> read_lock_fence;
|
| if (use_sync_query_) {
|
| + // Block until oldest sync query has passed if the number of pending queries
|
| + // ever reach kMaxPendingSyncQueries.
|
| + if (pending_sync_queries_.size() >= kMaxPendingSyncQueries) {
|
| + LOG(ERROR) << "Reached limit of pending sync queries.";
|
| +
|
| + pending_sync_queries_.front()->Wait();
|
| + DCHECK(!pending_sync_queries_.front()->IsPending());
|
| + }
|
| +
|
| while (!pending_sync_queries_.empty()) {
|
| if (pending_sync_queries_.front()->IsPending())
|
| break;
|
|
|