Chromium Code Reviews| Index: content/browser/gpu/gpu_process_host.cc |
| diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc |
| index 9e5861e3e6fe446bd48f8d29612263c436683fec..e8e32c2d2a49ae5895b06bae9fe08b38f3ff289c 100644 |
| --- a/content/browser/gpu/gpu_process_host.cc |
| +++ b/content/browser/gpu/gpu_process_host.cc |
| @@ -64,6 +64,8 @@ bool GpuProcessHost::hardware_gpu_enabled_ = true; |
| namespace { |
| +const unsigned int kMaxLatencyInfoNumber = 100; |
| + |
| enum GPUProcessLifetimeEvent { |
| LAUNCHED, |
| DIED_FIRST_TIME, |
| @@ -132,7 +134,7 @@ void AcceleratedSurfaceBuffersSwappedCompletedForRenderer( |
| int surface_id, |
| base::TimeTicks timebase, |
| base::TimeDelta interval, |
| - const ui::LatencyInfo& latency_info) { |
| + const std::vector<ui::LatencyInfo>& latency_info) { |
| if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| BrowserThread::PostTask( |
| BrowserThread::UI, |
| @@ -167,7 +169,7 @@ void AcceleratedSurfaceBuffersSwappedCompleted( |
| bool alive, |
| base::TimeTicks timebase, |
| base::TimeDelta interval, |
| - const ui::LatencyInfo& latency_info) { |
| + const std::vector<ui::LatencyInfo>& latency_info) { |
| AcceleratedSurfaceBuffersSwappedCompletedForGPU( |
| host_id, route_id, alive, timebase, interval); |
| AcceleratedSurfaceBuffersSwappedCompletedForRenderer( |
| @@ -877,6 +879,12 @@ void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( |
| const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { |
| TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); |
| + if (params.latency_info.size() > kMaxLatencyInfoNumber) { |
| + LOG(ERROR) << "GpuHostMsg_AcceleratedSurfaceBuffersSwapped LatencyInfo" |
| + << " size " << params.latency_info.size() << " is too big."; |
|
Ken Russell (switch to Gerrit)
2014/01/15 06:41:29
Please refactor this duplicated code and constant
Yufeng Shen (Slow to review)
2014/01/15 19:44:31
Done.
|
| + return; |
| + } |
| + |
| gfx::GLSurfaceHandle surface_handle = |
| GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id); |
| // Compositor window is always gfx::kNullPluginWindow. |
| @@ -929,10 +937,17 @@ void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( |
| const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { |
| TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); |
| + if (params.latency_info.size() > kMaxLatencyInfoNumber) { |
| + LOG(ERROR) << "GpuHostMsg_AcceleratedSurfaceBuffersSwapped LatencyInfo" |
| + << " size " << params.latency_info.size() << " is too big."; |
| + return; |
| + } |
| + |
| base::ScopedClosureRunner scoped_completion_runner( |
| base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, |
| host_id_, params.route_id, params.surface_id, |
| - true, base::TimeTicks(), base::TimeDelta(), ui::LatencyInfo())); |
| + true, base::TimeTicks(), base::TimeDelta(), |
| + std::vector<ui::LatencyInfo>())); |
| gfx::GLSurfaceHandle handle = |
| GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id); |
| @@ -999,6 +1014,12 @@ void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer( |
| const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { |
| TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer"); |
| + if (params.latency_info.size() > kMaxLatencyInfoNumber) { |
| + LOG(ERROR) << "GpuHostMsg_AcceleratedSurfacePostSubBuffer LatencyInfo" |
| + << " size " << params.latency_info.size() << " is too big."; |
| + return; |
| + } |
| + |
| NOTIMPLEMENTED(); |
| } |