| Index: gpu/ipc/service/pass_through_image_transport_surface.cc
|
| diff --git a/gpu/ipc/service/pass_through_image_transport_surface.cc b/gpu/ipc/service/pass_through_image_transport_surface.cc
|
| index 8e11cad097db652d4cde4f94dc0c1fd1669597cd..1e3f153b5377c969bb6e1acb68503e7bc583cb28 100644
|
| --- a/gpu/ipc/service/pass_through_image_transport_surface.cc
|
| +++ b/gpu/ipc/service/pass_through_image_transport_surface.cc
|
| @@ -8,8 +8,6 @@
|
| #include "base/bind_helpers.h"
|
| #include "base/command_line.h"
|
| #include "build/build_config.h"
|
| -#include "gpu/ipc/common/gpu_messages.h"
|
| -#include "gpu/ipc/service/gpu_command_buffer_stub.h"
|
| #include "ui/gfx/vsync_provider.h"
|
| #include "ui/gl/gl_context.h"
|
| #include "ui/gl/gl_switches.h"
|
| @@ -17,19 +15,17 @@
|
| namespace gpu {
|
|
|
| PassThroughImageTransportSurface::PassThroughImageTransportSurface(
|
| - GpuCommandBufferStub* stub,
|
| + base::WeakPtr<ImageTransportSurfaceDelegate> delegate,
|
| gl::GLSurface* surface)
|
| : GLSurfaceAdapter(surface),
|
| - stub_(stub->AsWeakPtr()),
|
| + delegate_(delegate),
|
| did_set_swap_interval_(false),
|
| weak_ptr_factory_(this) {}
|
|
|
| bool PassThroughImageTransportSurface::Initialize(
|
| gl::GLSurface::Format format) {
|
| // The surface is assumed to have already been initialized.
|
| - if (!stub_.get() || !stub_->decoder())
|
| - return false;
|
| - stub_->SetLatencyInfoCallback(
|
| + delegate_->SetLatencyInfoCallback(
|
| base::Bind(&PassThroughImageTransportSurface::SetLatencyInfo,
|
| base::Unretained(this)));
|
| return true;
|
| @@ -131,8 +127,8 @@ bool PassThroughImageTransportSurface::OnMakeCurrent(gl::GLContext* context) {
|
| }
|
|
|
| PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {
|
| - if (stub_.get()) {
|
| - stub_->SetLatencyInfoCallback(
|
| + if (delegate_) {
|
| + delegate_->SetLatencyInfoCallback(
|
| base::Callback<void(const std::vector<ui::LatencyInfo>&)>());
|
| }
|
| }
|
| @@ -146,8 +142,10 @@ void PassThroughImageTransportSurface::SetLatencyInfo(
|
| void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
|
| gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
|
| if (vsync_provider) {
|
| + // PassThroughImageTransportSurface owns the VSyncProvider and will
|
| + // outlive it. Thus, base::Unretained is safe here.
|
| vsync_provider->GetVSyncParameters(base::Bind(
|
| - &GpuCommandBufferStub::SendUpdateVSyncParameters, stub_->AsWeakPtr()));
|
| + &ImageTransportSurfaceDelegate::UpdateVSyncParameters, delegate_));
|
| }
|
| }
|
|
|
| @@ -180,10 +178,12 @@ void PassThroughImageTransportSurface::FinishSwapBuffers(
|
| swap_ack_time, 1);
|
| }
|
|
|
| - GpuCommandBufferMsg_SwapBuffersCompleted_Params params;
|
| - params.latency_info = *latency_info;
|
| - params.result = result;
|
| - stub_->SendSwapBuffersCompleted(params);
|
| + if (delegate_) {
|
| + SwapBuffersCompleteParams params;
|
| + params.latency_info = std::move(*latency_info);
|
| + params.result = result;
|
| + delegate_->DidSwapBuffersComplete(std::move(params));
|
| + }
|
| }
|
|
|
| void PassThroughImageTransportSurface::FinishSwapBuffersAsync(
|
|
|