| 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/browser/gpu/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 if (host) { | 93 if (host) { |
| 94 host->Send(message); | 94 host->Send(message); |
| 95 } else { | 95 } else { |
| 96 delete message; | 96 delete message; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id, | 100 void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id, |
| 101 int route_id, | 101 int route_id, |
| 102 bool alive, | 102 bool alive, |
| 103 bool did_swap) { | 103 uint64 surface_handle) { |
| 104 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 104 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 105 BrowserThread::PostTask( | 105 BrowserThread::PostTask( |
| 106 BrowserThread::IO, | 106 BrowserThread::IO, |
| 107 FROM_HERE, | 107 FROM_HERE, |
| 108 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, | 108 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, |
| 109 host_id, | 109 host_id, |
| 110 route_id, | 110 route_id, |
| 111 alive, | 111 alive, |
| 112 did_swap)); | 112 surface_handle)); |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 | 115 |
| 116 GpuProcessHost* host = GpuProcessHost::FromID(host_id); | 116 GpuProcessHost* host = GpuProcessHost::FromID(host_id); |
| 117 if (host) { | 117 if (host) { |
| 118 if (alive) | 118 if (alive) |
| 119 host->Send(new AcceleratedSurfaceMsg_BufferPresented( | 119 host->Send(new AcceleratedSurfaceMsg_BufferPresented( |
| 120 route_id, did_swap, 0)); | 120 route_id, surface_handle, 0)); |
| 121 else | 121 else |
| 122 host->ForceShutdown(); | 122 host->ForceShutdown(); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 #if defined(OS_WIN) | 126 #if defined(OS_WIN) |
| 127 // This sends a ViewMsg_SwapBuffers_ACK directly to the renderer process | 127 // This sends a ViewMsg_SwapBuffers_ACK directly to the renderer process |
| 128 // (RenderWidget). This path is currently not used with the threaded compositor. | 128 // (RenderWidget). This path is currently not used with the threaded compositor. |
| 129 void AcceleratedSurfaceBuffersSwappedCompletedForRenderer( | 129 void AcceleratedSurfaceBuffersSwappedCompletedForRenderer( |
| 130 int surface_id, | 130 int surface_id, |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no | 672 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no |
| 673 // plugin windows. | 673 // plugin windows. |
| 674 if (handle != gfx::kNullPluginWindow) { | 674 if (handle != gfx::kNullPluginWindow) { |
| 675 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); | 675 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); |
| 676 return; | 676 return; |
| 677 } | 677 } |
| 678 | 678 |
| 679 base::ScopedClosureRunner scoped_completion_runner( | 679 base::ScopedClosureRunner scoped_completion_runner( |
| 680 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, | 680 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, |
| 681 host_id_, params.route_id, | 681 host_id_, params.route_id, |
| 682 true /* alive */, false /* presented */)); | 682 true /* alive */, params.surface_handle)); |
| 683 | 683 |
| 684 int render_process_id = 0; | 684 int render_process_id = 0; |
| 685 int render_widget_id = 0; | 685 int render_widget_id = 0; |
| 686 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( | 686 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( |
| 687 params.surface_id, &render_process_id, &render_widget_id)) { | 687 params.surface_id, &render_process_id, &render_widget_id)) { |
| 688 return; | 688 return; |
| 689 } | 689 } |
| 690 RenderWidgetHelper* helper = | 690 RenderWidgetHelper* helper = |
| 691 RenderWidgetHelper::FromProcessHostID(render_process_id); | 691 RenderWidgetHelper::FromProcessHostID(render_process_id); |
| 692 if (!helper) | 692 if (!helper) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 708 #endif // OS_MACOSX | 708 #endif // OS_MACOSX |
| 709 | 709 |
| 710 #if defined(OS_WIN) | 710 #if defined(OS_WIN) |
| 711 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( | 711 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( |
| 712 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { | 712 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { |
| 713 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); | 713 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); |
| 714 | 714 |
| 715 base::ScopedClosureRunner scoped_completion_runner( | 715 base::ScopedClosureRunner scoped_completion_runner( |
| 716 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, | 716 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, |
| 717 host_id_, params.route_id, params.surface_id, | 717 host_id_, params.route_id, params.surface_id, |
| 718 true, base::TimeTicks(), base::TimeDelta())); | 718 params.surface_handle, base::TimeTicks(), base::TimeDelta())); |
| 719 | 719 |
| 720 gfx::PluginWindowHandle handle = | 720 gfx::PluginWindowHandle handle = |
| 721 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id); | 721 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id); |
| 722 | 722 |
| 723 if (!handle) { | 723 if (!handle) { |
| 724 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI", | 724 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI", |
| 725 "surface_id", params.surface_id); | 725 "surface_id", params.surface_id); |
| 726 #if defined(USE_AURA) | 726 #if defined(USE_AURA) |
| 727 // This is a content area swap, send it on to the UI thread. | 727 // This is a content area swap, send it on to the UI thread. |
| 728 scoped_completion_runner.Release(); | 728 scoped_completion_runner.Release(); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 const CreateCommandBufferCallback& callback, int32 route_id) { | 956 const CreateCommandBufferCallback& callback, int32 route_id) { |
| 957 callback.Run(route_id); | 957 callback.Run(route_id); |
| 958 } | 958 } |
| 959 | 959 |
| 960 void GpuProcessHost::CreateImageError( | 960 void GpuProcessHost::CreateImageError( |
| 961 const CreateImageCallback& callback, const gfx::Size size) { | 961 const CreateImageCallback& callback, const gfx::Size size) { |
| 962 callback.Run(size); | 962 callback.Run(size); |
| 963 } | 963 } |
| 964 | 964 |
| 965 } // namespace content | 965 } // namespace content |
| OLD | NEW |