| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/gpu/image_transport_surface.h" | 5 #include "content/common/gpu/image_transport_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 gfx::PluginWindowHandle handle) | 45 gfx::PluginWindowHandle handle) |
| 46 : surface_(surface), | 46 : surface_(surface), |
| 47 manager_(manager), | 47 manager_(manager), |
| 48 stub_(stub->AsWeakPtr()), | 48 stub_(stub->AsWeakPtr()), |
| 49 handle_(handle) { | 49 handle_(handle) { |
| 50 route_id_ = manager_->GenerateRouteID(); | 50 route_id_ = manager_->GenerateRouteID(); |
| 51 manager_->AddRoute(route_id_, this); | 51 manager_->AddRoute(route_id_, this); |
| 52 } | 52 } |
| 53 | 53 |
| 54 ImageTransportHelper::~ImageTransportHelper() { | 54 ImageTransportHelper::~ImageTransportHelper() { |
| 55 if (stub_) { | 55 if (stub_.get()) { |
| 56 stub_->SetLatencyInfoCallback( | 56 stub_->SetLatencyInfoCallback( |
| 57 base::Callback<void(const ui::LatencyInfo&)>()); | 57 base::Callback<void(const ui::LatencyInfo&)>()); |
| 58 } | 58 } |
| 59 manager_->RemoveRoute(route_id_); | 59 manager_->RemoveRoute(route_id_); |
| 60 } | 60 } |
| 61 | 61 |
| 62 bool ImageTransportHelper::Initialize() { | 62 bool ImageTransportHelper::Initialize() { |
| 63 gpu::gles2::GLES2Decoder* decoder = Decoder(); | 63 gpu::gles2::GLES2Decoder* decoder = Decoder(); |
| 64 | 64 |
| 65 if (!decoder) | 65 if (!decoder) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 context->SetSwapInterval(0); | 164 context->SetSwapInterval(0); |
| 165 else | 165 else |
| 166 context->SetSwapInterval(1); | 166 context->SetSwapInterval(1); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void ImageTransportHelper::Suspend() { | 169 void ImageTransportHelper::Suspend() { |
| 170 manager_->Send(new GpuHostMsg_AcceleratedSurfaceSuspend(stub_->surface_id())); | 170 manager_->Send(new GpuHostMsg_AcceleratedSurfaceSuspend(stub_->surface_id())); |
| 171 } | 171 } |
| 172 | 172 |
| 173 gpu::GpuScheduler* ImageTransportHelper::Scheduler() { | 173 gpu::GpuScheduler* ImageTransportHelper::Scheduler() { |
| 174 if (!stub_) | 174 if (!stub_.get()) |
| 175 return NULL; | 175 return NULL; |
| 176 return stub_->scheduler(); | 176 return stub_->scheduler(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() { | 179 gpu::gles2::GLES2Decoder* ImageTransportHelper::Decoder() { |
| 180 if (!stub_) | 180 if (!stub_.get()) |
| 181 return NULL; | 181 return NULL; |
| 182 return stub_->decoder(); | 182 return stub_->decoder(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void ImageTransportHelper::OnBufferPresented( | 185 void ImageTransportHelper::OnBufferPresented( |
| 186 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { | 186 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { |
| 187 surface_->OnBufferPresented(params); | 187 surface_->OnBufferPresented(params); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void ImageTransportHelper::OnResizeViewACK() { | 190 void ImageTransportHelper::OnResizeViewACK() { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { | 349 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { |
| 350 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); | 350 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); |
| 351 if (vsync_provider) { | 351 if (vsync_provider) { |
| 352 vsync_provider->GetVSyncParameters( | 352 vsync_provider->GetVSyncParameters( |
| 353 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, | 353 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, |
| 354 helper_->AsWeakPtr())); | 354 helper_->AsWeakPtr())); |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace content | 358 } // namespace content |
| OLD | NEW |