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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 GpuProcessHost* host = GpuProcessHost::FromID(host_id); | 119 GpuProcessHost* host = GpuProcessHost::FromID(host_id); |
120 if (host) { | 120 if (host) { |
121 if (alive) | 121 if (alive) |
122 host->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, 0)); | 122 host->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, 0)); |
123 else | 123 else |
124 host->ForceShutdown(); | 124 host->ForceShutdown(); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
| 128 #if defined(OS_WIN) |
128 // This sends a ViewMsg_SwapBuffers_ACK directly to the renderer process | 129 // This sends a ViewMsg_SwapBuffers_ACK directly to the renderer process |
129 // (RenderWidget). This path is currently not used with the threaded compositor. | 130 // (RenderWidget). This path is currently not used with the threaded compositor. |
130 void AcceleratedSurfaceBuffersSwappedCompletedForRenderer( | 131 void AcceleratedSurfaceBuffersSwappedCompletedForRenderer( |
131 int surface_id, | 132 int surface_id, |
132 base::TimeTicks timebase, | 133 base::TimeTicks timebase, |
133 base::TimeDelta interval) { | 134 base::TimeDelta interval) { |
134 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 135 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
135 BrowserThread::PostTask( | 136 BrowserThread::PostTask( |
136 BrowserThread::UI, | 137 BrowserThread::UI, |
137 FROM_HERE, | 138 FROM_HERE, |
(...skipping 22 matching lines...) Expand all Loading... |
160 void AcceleratedSurfaceBuffersSwappedCompleted(int host_id, | 161 void AcceleratedSurfaceBuffersSwappedCompleted(int host_id, |
161 int route_id, | 162 int route_id, |
162 int surface_id, | 163 int surface_id, |
163 bool alive, | 164 bool alive, |
164 base::TimeTicks timebase, | 165 base::TimeTicks timebase, |
165 base::TimeDelta interval) { | 166 base::TimeDelta interval) { |
166 AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id, alive); | 167 AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id, alive); |
167 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase, | 168 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase, |
168 interval); | 169 interval); |
169 } | 170 } |
| 171 #endif // defined(OS_WIN) |
170 | 172 |
171 } // anonymous namespace | 173 } // anonymous namespace |
172 | 174 |
173 #if defined(TOOLKIT_GTK) | 175 #if defined(TOOLKIT_GTK) |
174 // Used to put a lock on surfaces so that the window to which the GPU | 176 // Used to put a lock on surfaces so that the window to which the GPU |
175 // process is drawing to doesn't disappear while it is drawing when | 177 // process is drawing to doesn't disappear while it is drawing when |
176 // a WebContents is closed. | 178 // a WebContents is closed. |
177 class GpuProcessHost::SurfaceRef { | 179 class GpuProcessHost::SurfaceRef { |
178 public: | 180 public: |
179 explicit SurfaceRef(gfx::PluginWindowHandle surface); | 181 explicit SurfaceRef(gfx::PluginWindowHandle surface); |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 render_widget_id, | 658 render_widget_id, |
657 params.surface_id, | 659 params.surface_id, |
658 params.surface_handle, | 660 params.surface_handle, |
659 params.route_id, | 661 params.route_id, |
660 params.size, | 662 params.size, |
661 host_id_)); | 663 host_id_)); |
662 } | 664 } |
663 #endif // OS_MACOSX | 665 #endif // OS_MACOSX |
664 | 666 |
665 #if defined(OS_WIN) | 667 #if defined(OS_WIN) |
666 | |
667 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( | 668 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( |
668 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { | 669 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { |
669 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); | 670 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); |
670 | 671 |
671 base::ScopedClosureRunner scoped_completion_runner( | 672 base::ScopedClosureRunner scoped_completion_runner( |
672 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, | 673 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, |
673 host_id_, params.route_id, params.surface_id, | 674 host_id_, params.route_id, params.surface_id, |
674 true, base::TimeTicks(), base::TimeDelta())); | 675 true, base::TimeTicks(), base::TimeDelta())); |
675 | 676 |
676 gfx::PluginWindowHandle handle = | 677 gfx::PluginWindowHandle handle = |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 const IPC::ChannelHandle& channel_handle, | 905 const IPC::ChannelHandle& channel_handle, |
905 base::ProcessHandle renderer_process_for_gpu, | 906 base::ProcessHandle renderer_process_for_gpu, |
906 const content::GPUInfo& gpu_info) { | 907 const content::GPUInfo& gpu_info) { |
907 callback.Run(channel_handle, gpu_info); | 908 callback.Run(channel_handle, gpu_info); |
908 } | 909 } |
909 | 910 |
910 void GpuProcessHost::CreateCommandBufferError( | 911 void GpuProcessHost::CreateCommandBufferError( |
911 const CreateCommandBufferCallback& callback, int32 route_id) { | 912 const CreateCommandBufferCallback& callback, int32 route_id) { |
912 callback.Run(route_id); | 913 callback.Run(route_id); |
913 } | 914 } |
OLD | NEW |