| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 static GLint GetActiveTextureUnit(GLES2Interface* gl) { | 156 static GLint GetActiveTextureUnit(GLES2Interface* gl) { |
| 157 GLint active_unit = 0; | 157 GLint active_unit = 0; |
| 158 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 158 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
| 159 return active_unit; | 159 return active_unit; |
| 160 } | 160 } |
| 161 | 161 |
| 162 class GLRenderer::ScopedUseGrContext { | 162 class GLRenderer::ScopedUseGrContext { |
| 163 public: | 163 public: |
| 164 static scoped_ptr<ScopedUseGrContext> Create(GLRenderer* renderer, | 164 static scoped_ptr<ScopedUseGrContext> Create(GLRenderer* renderer, |
| 165 DrawingFrame* frame) { | 165 DrawingFrame* frame) { |
| 166 return make_scoped_ptr(new ScopedUseGrContext(renderer, frame)); | 166 // GrContext for filters is created lazily, and may fail if the context |
| 167 // is lost. |
| 168 // TODO(vmiura,bsalomon): crbug.com/487850 Ensure that |
| 169 // ContextProvider::GrContext() does not return NULL. |
| 170 if (renderer->output_surface_->context_provider()->GrContext()) |
| 171 return make_scoped_ptr(new ScopedUseGrContext(renderer, frame)); |
| 172 return nullptr; |
| 167 } | 173 } |
| 168 | 174 |
| 169 ~ScopedUseGrContext() { | 175 ~ScopedUseGrContext() { |
| 170 // Pass context control back to GLrenderer. | 176 // Pass context control back to GLrenderer. |
| 171 scoped_gpu_raster_ = nullptr; | 177 scoped_gpu_raster_ = nullptr; |
| 172 renderer_->RestoreGLState(); | 178 renderer_->RestoreGLState(); |
| 173 renderer_->RestoreFramebuffer(frame_); | 179 renderer_->RestoreFramebuffer(frame_); |
| 174 } | 180 } |
| 175 | 181 |
| 176 GrContext* context() const { | 182 GrContext* context() const { |
| (...skipping 3324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3501 context_support_->ScheduleOverlayPlane( | 3507 context_support_->ScheduleOverlayPlane( |
| 3502 overlay.plane_z_order, | 3508 overlay.plane_z_order, |
| 3503 overlay.transform, | 3509 overlay.transform, |
| 3504 pending_overlay_resources_.back()->texture_id(), | 3510 pending_overlay_resources_.back()->texture_id(), |
| 3505 ToNearestRect(overlay.display_rect), | 3511 ToNearestRect(overlay.display_rect), |
| 3506 overlay.uv_rect); | 3512 overlay.uv_rect); |
| 3507 } | 3513 } |
| 3508 } | 3514 } |
| 3509 | 3515 |
| 3510 } // namespace cc | 3516 } // namespace cc |
| OLD | NEW |