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

Unified Diff: cc/output/gl_renderer.cc

Issue 23454014: cc: Drop ContextProvider references on the impl thread before quitting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: callbackcontrolcenter: rebase Created 7 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 | « cc/output/gl_renderer.h ('k') | cc/output/gl_renderer_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 e430ebf0a330e67b93f1d164b08cdd031a9255c9..3d6607c18fa19c8573752f1b58f0317c3884ce01 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -33,6 +33,7 @@
#include "cc/resources/layer_quad.h"
#include "cc/resources/scoped_resource.h"
#include "cc/resources/sync_point_helper.h"
+#include "cc/resources/texture_mailbox_deleter.h"
#include "cc/trees/damage_tracker.h"
#include "cc/trees/proxy.h"
#include "cc/trees/single_thread_proxy.h"
@@ -126,16 +127,19 @@ struct GLRenderer::PendingAsyncReadPixels {
DISALLOW_COPY_AND_ASSIGN(PendingAsyncReadPixels);
};
-scoped_ptr<GLRenderer> GLRenderer::Create(RendererClient* client,
- const LayerTreeSettings* settings,
- OutputSurface* output_surface,
- ResourceProvider* resource_provider,
- int highp_threshold_min,
- bool use_skia_gpu_backend) {
+scoped_ptr<GLRenderer> GLRenderer::Create(
+ RendererClient* client,
+ const LayerTreeSettings* settings,
+ OutputSurface* output_surface,
+ ResourceProvider* resource_provider,
+ TextureMailboxDeleter* texture_mailbox_deleter,
+ int highp_threshold_min,
+ bool use_skia_gpu_backend) {
scoped_ptr<GLRenderer> renderer(new GLRenderer(client,
settings,
output_surface,
resource_provider,
+ texture_mailbox_deleter,
highp_threshold_min));
if (!renderer->Initialize())
return scoped_ptr<GLRenderer>();
@@ -152,11 +156,13 @@ GLRenderer::GLRenderer(RendererClient* client,
const LayerTreeSettings* settings,
OutputSurface* output_surface,
ResourceProvider* resource_provider,
+ TextureMailboxDeleter* texture_mailbox_deleter,
int highp_threshold_min)
: DirectRenderer(client, settings, output_surface, resource_provider),
offscreen_framebuffer_id_(0),
shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)),
context_(output_surface->context_provider()->Context3d()),
+ texture_mailbox_deleter_(texture_mailbox_deleter),
is_backbuffer_discarded_(false),
discard_backbuffer_when_not_visible_(false),
is_using_bind_uniform_(false),
@@ -2183,31 +2189,6 @@ void GLRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) {
AsyncGetFramebufferPixelsCleanupCallback());
}
-static void DeleteTextureReleaseCallbackOnImplThread(
- const scoped_refptr<ContextProvider>& context_provider,
- unsigned texture_id,
- unsigned sync_point,
- bool lost_resource) {
- if (sync_point)
- context_provider->Context3d()->waitSyncPoint(sync_point);
- context_provider->Context3d()->deleteTexture(texture_id);
-}
-
-static void DeleteTextureReleaseCallback(
- const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
- const scoped_refptr<ContextProvider>& context_provider,
- unsigned texture_id,
- unsigned sync_point,
- bool lost_resource) {
- task_runner->PostTask(
- FROM_HERE,
- base::Bind(&DeleteTextureReleaseCallbackOnImplThread,
- context_provider,
- texture_id,
- sync_point,
- lost_resource));
-}
-
void GLRenderer::GetFramebufferPixelsAsync(
gfx::Rect rect, scoped_ptr<CopyOutputRequest> request) {
DCHECK(!request->IsEmpty());
@@ -2251,10 +2232,8 @@ void GLRenderer::GetFramebufferPixelsAsync(
sync_point = context_->insertSyncPoint();
scoped_ptr<TextureMailbox> texture_mailbox = make_scoped_ptr(
new TextureMailbox(mailbox,
- base::Bind(&DeleteTextureReleaseCallback,
- base::MessageLoopProxy::current(),
- output_surface_->context_provider(),
- texture_id),
+ texture_mailbox_deleter_->GetReleaseCallback(
+ output_surface_->context_provider(), texture_id),
GL_TEXTURE_2D,
sync_point));
request->SendTextureResult(window_rect.size(), texture_mailbox.Pass());
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698