Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 11642051: Reland 174257 with fix for win_aura (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/surface/accelerated_surface_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 GpuProcessHost* host = GpuProcessHost::Get(kind, cause); 95 GpuProcessHost* host = GpuProcessHost::Get(kind, cause);
96 if (host) { 96 if (host) {
97 host->Send(message); 97 host->Send(message);
98 } else { 98 } else {
99 delete message; 99 delete message;
100 } 100 }
101 } 101 }
102 102
103 void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id, 103 void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id,
104 int route_id, 104 int route_id,
105 bool alive, 105 uint64 surface_handle,
106 uint64 surface_handle) { 106 bool alive) {
107 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 107 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
108 BrowserThread::PostTask( 108 BrowserThread::PostTask(
109 BrowserThread::IO, 109 BrowserThread::IO,
110 FROM_HERE, 110 FROM_HERE,
111 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, 111 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
112 host_id, 112 host_id,
113 route_id, 113 route_id,
114 alive, 114 surface_handle,
115 surface_handle)); 115 alive));
116 return; 116 return;
117 } 117 }
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 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; 122 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
123 ack_params.sync_point = 0; 123 ack_params.sync_point = 0;
124 host->Send(new AcceleratedSurfaceMsg_BufferPresented( 124 host->Send(new AcceleratedSurfaceMsg_BufferPresented(
125 route_id, ack_params)); 125 route_id, ack_params));
(...skipping 28 matching lines...) Expand all
154 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id); 154 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id);
155 if (!host) 155 if (!host)
156 return; 156 return;
157 RenderWidgetHost* rwh = host->GetRenderWidgetHostByID(render_widget_id); 157 RenderWidgetHost* rwh = host->GetRenderWidgetHostByID(render_widget_id);
158 if (!rwh) 158 if (!rwh)
159 return; 159 return;
160 RenderWidgetHostImpl::From(rwh)->AcknowledgeSwapBuffersToRenderer(); 160 RenderWidgetHostImpl::From(rwh)->AcknowledgeSwapBuffersToRenderer();
161 if (interval != base::TimeDelta()) 161 if (interval != base::TimeDelta())
162 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval); 162 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval);
163 } 163 }
164
165 void AcceleratedSurfaceBuffersSwappedCompleted(int host_id,
166 int route_id,
167 int surface_id,
168 uint64 surface_handle,
169 bool alive,
170 base::TimeTicks timebase,
171 base::TimeDelta interval) {
172 AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id,
173 alive, surface_handle);
174 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase,
175 interval);
176 }
177 #endif // defined(OS_WIN) 164 #endif // defined(OS_WIN)
178 165
179 } // anonymous namespace 166 } // anonymous namespace
180 167
181 #if defined(TOOLKIT_GTK) 168 #if defined(TOOLKIT_GTK)
182 // Used to put a lock on surfaces so that the window to which the GPU 169 // Used to put a lock on surfaces so that the window to which the GPU
183 // process is drawing to doesn't disappear while it is drawing when 170 // process is drawing to doesn't disappear while it is drawing when
184 // a WebContents is closed. 171 // a WebContents is closed.
185 class GpuProcessHost::SurfaceRef { 172 class GpuProcessHost::SurfaceRef {
186 public: 173 public:
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no 788 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no
802 // plugin windows. 789 // plugin windows.
803 if (handle != gfx::kNullPluginWindow) { 790 if (handle != gfx::kNullPluginWindow) {
804 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 791 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
805 return; 792 return;
806 } 793 }
807 794
808 base::ScopedClosureRunner scoped_completion_runner( 795 base::ScopedClosureRunner scoped_completion_runner(
809 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, 796 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
810 host_id_, params.route_id, 797 host_id_, params.route_id,
811 true /* alive */, params.surface_handle)); 798 params.surface_handle, true /* alive */));
812 799
813 int render_process_id = 0; 800 int render_process_id = 0;
814 int render_widget_id = 0; 801 int render_widget_id = 0;
815 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( 802 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface(
816 params.surface_id, &render_process_id, &render_widget_id)) { 803 params.surface_id, &render_process_id, &render_widget_id)) {
817 return; 804 return;
818 } 805 }
819 RenderWidgetHelper* helper = 806 RenderWidgetHelper* helper =
820 RenderWidgetHelper::FromProcessHostID(render_process_id); 807 RenderWidgetHelper::FromProcessHostID(render_process_id);
821 if (!helper) 808 if (!helper)
(...skipping 12 matching lines...) Expand all
834 params.size, 821 params.size,
835 host_id_)); 822 host_id_));
836 } 823 }
837 #endif // OS_MACOSX 824 #endif // OS_MACOSX
838 825
839 #if defined(OS_WIN) 826 #if defined(OS_WIN)
840 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( 827 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
841 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 828 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
842 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); 829 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped");
843 830
844 base::ScopedClosureRunner scoped_completion_runner( 831 base::ScopedClosureRunner scoped_present_completion_runner(
845 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, 832 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForRenderer,
846 host_id_, params.route_id, params.surface_id, params.surface_handle, 833 params.surface_id,
847 true, base::TimeTicks(), base::TimeDelta())); 834 base::TimeTicks(),
835 base::TimeDelta()));
836 base::ScopedClosureRunner scoped_copy_completion_runner(
837 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
838 host_id_,
839 params.route_id,
840 params.surface_handle,
841 true));
848 842
849 gfx::PluginWindowHandle handle = 843 gfx::PluginWindowHandle handle =
850 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id); 844 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id);
851 845
852 if (!handle) { 846 if (!handle) {
853 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI", 847 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI",
854 "surface_id", params.surface_id); 848 "surface_id", params.surface_id);
855 #if defined(USE_AURA) 849 #if defined(USE_AURA)
856 // This is a content area swap, send it on to the UI thread. 850 // This is a content area swap, send it on to the UI thread.
857 scoped_completion_runner.Release(); 851 scoped_copy_completion_runner.Release();
852 scoped_present_completion_runner.Release();
858 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 853 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
859 #endif 854 #endif
860 return; 855 return;
861 } 856 }
862 857
863 // Otherwise it's the UI swap. 858 // Otherwise it's the UI swap.
864 859
865 scoped_refptr<AcceleratedPresenter> presenter( 860 scoped_refptr<AcceleratedPresenter> presenter(
866 AcceleratedPresenter::GetForWindow(handle)); 861 AcceleratedPresenter::GetForWindow(handle));
867 if (!presenter) { 862 if (!presenter) {
868 TRACE_EVENT1("gpu", "EarlyOut_NativeWindowNotFound", "handle", handle); 863 TRACE_EVENT1("gpu", "EarlyOut_NativeWindowNotFound", "handle", handle);
869 return; 864 return;
870 } 865 }
871 866
872 scoped_completion_runner.Release(); 867 scoped_copy_completion_runner.Release();
868 scoped_present_completion_runner.Release();
873 presenter->AsyncPresentAndAcknowledge( 869 presenter->AsyncPresentAndAcknowledge(
874 params.size, 870 params.size,
875 params.surface_handle, 871 params.surface_handle,
876 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, 872 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
877 host_id_, 873 host_id_,
878 params.route_id, 874 params.route_id,
879 params.surface_id, 875 params.surface_handle),
880 params.surface_handle)); 876 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForRenderer,
877 params.surface_id));
881 } 878 }
882 879
883 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer( 880 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer(
884 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { 881 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
885 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer"); 882 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer");
886 883
887 NOTIMPLEMENTED(); 884 NOTIMPLEMENTED();
888 } 885 }
889 886
890 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) { 887 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 void GpuProcessHost::BlockLiveOffscreenContexts() { 1093 void GpuProcessHost::BlockLiveOffscreenContexts() {
1097 for (std::multiset<GURL>::iterator iter = 1094 for (std::multiset<GURL>::iterator iter =
1098 urls_with_live_offscreen_contexts_.begin(); 1095 urls_with_live_offscreen_contexts_.begin();
1099 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { 1096 iter != urls_with_live_offscreen_contexts_.end(); ++iter) {
1100 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( 1097 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(
1101 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); 1098 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN);
1102 } 1099 }
1103 } 1100 }
1104 1101
1105 } // namespace content 1102 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/surface/accelerated_surface_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698