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

Unified Diff: cc/output/gl_renderer.cc

Issue 817653003: Update from https://crrev.com/309717 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « cc/output/delegating_renderer_unittest.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 903805b2775a7a6292f77c5d10a22c09669884e0..e40a4fc44fff24906cbb6c4a71f2e9385cf7cdc5 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -26,6 +26,7 @@
#include "cc/quads/stream_video_draw_quad.h"
#include "cc/quads/texture_draw_quad.h"
#include "cc/resources/layer_quad.h"
+#include "cc/resources/scoped_gpu_raster.h"
#include "cc/resources/scoped_resource.h"
#include "cc/resources/texture_mailbox_deleter.h"
#include "gpu/GLES2/gl2extchromium.h"
@@ -157,7 +158,12 @@ class GLRenderer::ScopedUseGrContext {
return make_scoped_ptr(new ScopedUseGrContext(renderer, frame));
}
- ~ScopedUseGrContext() { PassControlToGLRenderer(); }
+ ~ScopedUseGrContext() {
+ // Pass context control back to GLrenderer.
+ scoped_gpu_raster_ = nullptr;
+ renderer_->RestoreGLState();
+ renderer_->RestoreFramebuffer(frame_);
+ }
GrContext* context() const {
return renderer_->output_surface_->context_provider()->GrContext();
@@ -165,17 +171,14 @@ class GLRenderer::ScopedUseGrContext {
private:
ScopedUseGrContext(GLRenderer* renderer, DrawingFrame* frame)
- : renderer_(renderer), frame_(frame) {
- PassControlToSkia();
- }
-
- void PassControlToSkia() { context()->resetContext(); }
-
- void PassControlToGLRenderer() {
- renderer_->RestoreGLState();
- renderer_->RestoreFramebuffer(frame_);
+ : scoped_gpu_raster_(
+ new ScopedGpuRaster(renderer->output_surface_->context_provider())),
+ renderer_(renderer),
+ frame_(frame) {
+ // scoped_gpu_raster_ passes context control to Skia.
}
+ scoped_ptr<ScopedGpuRaster> scoped_gpu_raster_;
GLRenderer* renderer_;
DrawingFrame* frame_;
« no previous file with comments | « cc/output/delegating_renderer_unittest.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698