| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_) { |
| 56 stub_->SetLatencyInfoCallback( | 56 stub_->SetLatencyInfoCallback( |
| 57 base::Callback<void(const cc::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) |
| 66 return false; | 66 return false; |
| 67 | 67 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 void ImageTransportHelper::SendUpdateVSyncParameters( | 123 void ImageTransportHelper::SendUpdateVSyncParameters( |
| 124 base::TimeTicks timebase, base::TimeDelta interval) { | 124 base::TimeTicks timebase, base::TimeDelta interval) { |
| 125 manager_->Send(new GpuHostMsg_UpdateVSyncParameters(stub_->surface_id(), | 125 manager_->Send(new GpuHostMsg_UpdateVSyncParameters(stub_->surface_id(), |
| 126 timebase, | 126 timebase, |
| 127 interval)); | 127 interval)); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void ImageTransportHelper::SendLatencyInfo( | 130 void ImageTransportHelper::SendLatencyInfo( |
| 131 const cc::LatencyInfo& latency_info) { | 131 const ui::LatencyInfo& latency_info) { |
| 132 manager_->Send(new GpuHostMsg_FrameDrawn(latency_info)); | 132 manager_->Send(new GpuHostMsg_FrameDrawn(latency_info)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void ImageTransportHelper::SetScheduled(bool is_scheduled) { | 135 void ImageTransportHelper::SetScheduled(bool is_scheduled) { |
| 136 gpu::GpuScheduler* scheduler = Scheduler(); | 136 gpu::GpuScheduler* scheduler = Scheduler(); |
| 137 if (!scheduler) | 137 if (!scheduler) |
| 138 return; | 138 return; |
| 139 | 139 |
| 140 scheduler->SetScheduled(is_scheduled); | 140 scheduler->SetScheduled(is_scheduled); |
| 141 } | 141 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 void ImageTransportHelper::Resize(gfx::Size size, float scale_factor) { | 194 void ImageTransportHelper::Resize(gfx::Size size, float scale_factor) { |
| 195 surface_->OnResize(size, scale_factor); | 195 surface_->OnResize(size, scale_factor); |
| 196 | 196 |
| 197 #if defined(OS_ANDROID) | 197 #if defined(OS_ANDROID) |
| 198 manager_->gpu_memory_manager()->ScheduleManage( | 198 manager_->gpu_memory_manager()->ScheduleManage( |
| 199 GpuMemoryManager::kScheduleManageNow); | 199 GpuMemoryManager::kScheduleManageNow); |
| 200 #endif | 200 #endif |
| 201 } | 201 } |
| 202 | 202 |
| 203 void ImageTransportHelper::SetLatencyInfo( | 203 void ImageTransportHelper::SetLatencyInfo( |
| 204 const cc::LatencyInfo& latency_info) { | 204 const ui::LatencyInfo& latency_info) { |
| 205 surface_->SetLatencyInfo(latency_info); | 205 surface_->SetLatencyInfo(latency_info); |
| 206 } | 206 } |
| 207 | 207 |
| 208 PassThroughImageTransportSurface::PassThroughImageTransportSurface( | 208 PassThroughImageTransportSurface::PassThroughImageTransportSurface( |
| 209 GpuChannelManager* manager, | 209 GpuChannelManager* manager, |
| 210 GpuCommandBufferStub* stub, | 210 GpuCommandBufferStub* stub, |
| 211 gfx::GLSurface* surface, | 211 gfx::GLSurface* surface, |
| 212 bool transport) | 212 bool transport) |
| 213 : GLSurfaceAdapter(surface), | 213 : GLSurfaceAdapter(surface), |
| 214 transport_(transport), | 214 transport_(transport), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 235 if (is_swap_buffers_pending_) { | 235 if (is_swap_buffers_pending_) { |
| 236 DCHECK(!did_unschedule_); | 236 DCHECK(!did_unschedule_); |
| 237 did_unschedule_ = true; | 237 did_unschedule_ = true; |
| 238 helper_->SetScheduled(false); | 238 helper_->SetScheduled(false); |
| 239 return true; | 239 return true; |
| 240 } | 240 } |
| 241 return false; | 241 return false; |
| 242 } | 242 } |
| 243 | 243 |
| 244 void PassThroughImageTransportSurface::SetLatencyInfo( | 244 void PassThroughImageTransportSurface::SetLatencyInfo( |
| 245 const cc::LatencyInfo& latency_info) { | 245 const ui::LatencyInfo& latency_info) { |
| 246 latency_info_ = latency_info; | 246 latency_info_ = latency_info; |
| 247 } | 247 } |
| 248 | 248 |
| 249 bool PassThroughImageTransportSurface::SwapBuffers() { | 249 bool PassThroughImageTransportSurface::SwapBuffers() { |
| 250 // GetVsyncValues before SwapBuffers to work around Mali driver bug: | 250 // GetVsyncValues before SwapBuffers to work around Mali driver bug: |
| 251 // crbug.com/223558. | 251 // crbug.com/223558. |
| 252 SendVSyncUpdateIfAvailable(); | 252 SendVSyncUpdateIfAvailable(); |
| 253 bool result = gfx::GLSurfaceAdapter::SwapBuffers(); | 253 bool result = gfx::GLSurfaceAdapter::SwapBuffers(); |
| 254 latency_info_.swap_timestamp = base::TimeTicks::HighResNow(); | 254 latency_info_.swap_timestamp = base::TimeTicks::HighResNow(); |
| 255 | 255 |
| (...skipping 93 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 |