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

Unified Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 1176643002: Use callback instead of weak pointer in OutputSurfaceWithoutParent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@output_surface_task_runner
Patch Set: Created 5 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/compositor_impl_android.cc
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index e29ce82e6ba1ad589d268da1329a8ca40ba4df4b..babed85d6ef19e8f65e3b4e190a33eaa0015e74b 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -74,14 +74,15 @@ class OutputSurfaceWithoutParent : public cc::OutputSurface {
public:
OutputSurfaceWithoutParent(
const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
- base::WeakPtr<CompositorImpl> compositor_impl)
+ const base::Callback<void(gpu::Capabilities)>&
+ populate_gpu_capabilities_callback)
: cc::OutputSurface(context_provider),
+ populate_gpu_capabilities_callback_(populate_gpu_capabilities_callback),
swap_buffers_completion_callback_(
base::Bind(&OutputSurfaceWithoutParent::OnSwapBuffersCompleted,
base::Unretained(this))) {
capabilities_.adjust_deadline_for_parent = false;
capabilities_.max_frames_pending = 2;
- compositor_impl_ = compositor_impl;
}
void SwapBuffers(cc::CompositorFrame* frame) override {
@@ -99,7 +100,7 @@ class OutputSurfaceWithoutParent : public cc::OutputSurface {
GetCommandBufferProxy()->SetSwapBuffersCompletionCallback(
swap_buffers_completion_callback_.callback());
- compositor_impl_->PopulateGpuCapabilities(
+ populate_gpu_capabilities_callback_.Run(
context_provider_->ContextCapabilities().gpu);
return true;
@@ -122,11 +123,10 @@ class OutputSurfaceWithoutParent : public cc::OutputSurface {
OutputSurface::OnSwapBuffersComplete();
}
+ base::Callback<void(gpu::Capabilities)> populate_gpu_capabilities_callback_;
base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&,
gfx::SwapResult)>
swap_buffers_completion_callback_;
-
- base::WeakPtr<CompositorImpl> compositor_impl_;
};
static bool g_initialized = false;
@@ -643,8 +643,9 @@ void CompositorImpl::CreateOutputSurface() {
DCHECK(context_provider.get());
scoped_ptr<cc::OutputSurface> real_output_surface(
- new OutputSurfaceWithoutParent(context_provider,
- weak_factory_.GetWeakPtr()));
+ new OutputSurfaceWithoutParent(
+ context_provider, base::Bind(&CompositorImpl::PopulateGpuCapabilities,
+ weak_factory_.GetWeakPtr())));
no sievers 2015/06/09 22:48:30 The OutputSurface should not be able to outlive th
sunnyps 2015/06/09 23:39:35 Done.
cc::SurfaceManager* manager = GetSurfaceManager();
if (manager) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698