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

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

Issue 11782018: Revert 174920 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 GpuProcessHost* host = GpuProcessHost::Get(kind, cause); 78 GpuProcessHost* host = GpuProcessHost::Get(kind, cause);
79 if (host) { 79 if (host) {
80 host->Send(message); 80 host->Send(message);
81 } else { 81 } else {
82 delete message; 82 delete message;
83 } 83 }
84 } 84 }
85 85
86 void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id, 86 void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id,
87 int route_id, 87 int route_id,
88 uint64 surface_handle, 88 bool alive,
89 bool alive) { 89 uint64 surface_handle) {
90 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 90 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
91 BrowserThread::PostTask( 91 BrowserThread::PostTask(
92 BrowserThread::IO, 92 BrowserThread::IO,
93 FROM_HERE, 93 FROM_HERE,
94 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, 94 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
95 host_id, 95 host_id,
96 route_id, 96 route_id,
97 surface_handle, 97 alive,
98 alive)); 98 surface_handle));
99 return; 99 return;
100 } 100 }
101 101
102 GpuProcessHost* host = GpuProcessHost::FromID(host_id); 102 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
103 if (host) { 103 if (host) {
104 if (alive) { 104 if (alive) {
105 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; 105 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
106 ack_params.sync_point = 0; 106 ack_params.sync_point = 0;
107 host->Send( 107 host->Send(
108 new AcceleratedSurfaceMsg_BufferPresented(route_id, ack_params)); 108 new AcceleratedSurfaceMsg_BufferPresented(route_id, ack_params));
(...skipping 28 matching lines...) Expand all
137 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id); 137 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id);
138 if (!host) 138 if (!host)
139 return; 139 return;
140 RenderWidgetHost* rwh = host->GetRenderWidgetHostByID(render_widget_id); 140 RenderWidgetHost* rwh = host->GetRenderWidgetHostByID(render_widget_id);
141 if (!rwh) 141 if (!rwh)
142 return; 142 return;
143 RenderWidgetHostImpl::From(rwh)->AcknowledgeSwapBuffersToRenderer(); 143 RenderWidgetHostImpl::From(rwh)->AcknowledgeSwapBuffersToRenderer();
144 if (interval != base::TimeDelta()) 144 if (interval != base::TimeDelta())
145 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval); 145 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval);
146 } 146 }
147
148 void AcceleratedSurfaceBuffersSwappedCompleted(int host_id,
149 int route_id,
150 int surface_id,
151 uint64 surface_handle,
152 bool alive,
153 base::TimeTicks timebase,
154 base::TimeDelta interval) {
155 AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id,
156 alive, surface_handle);
157 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase,
158 interval);
159 }
147 #endif // defined(OS_WIN) 160 #endif // defined(OS_WIN)
148 161
149 } // anonymous namespace 162 } // anonymous namespace
150 163
151 #if defined(TOOLKIT_GTK) 164 #if defined(TOOLKIT_GTK)
152 // Used to put a lock on surfaces so that the window to which the GPU 165 // Used to put a lock on surfaces so that the window to which the GPU
153 // process is drawing to doesn't disappear while it is drawing when 166 // process is drawing to doesn't disappear while it is drawing when
154 // a WebContents is closed. 167 // a WebContents is closed.
155 class GpuProcessHost::SurfaceRef { 168 class GpuProcessHost::SurfaceRef {
156 public: 169 public:
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no 771 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no
759 // plugin windows. 772 // plugin windows.
760 if (handle != gfx::kNullPluginWindow) { 773 if (handle != gfx::kNullPluginWindow) {
761 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 774 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
762 return; 775 return;
763 } 776 }
764 777
765 base::ScopedClosureRunner scoped_completion_runner( 778 base::ScopedClosureRunner scoped_completion_runner(
766 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, 779 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
767 host_id_, params.route_id, 780 host_id_, params.route_id,
768 params.surface_handle, true /* alive */)); 781 true /* alive */, params.surface_handle));
769 782
770 int render_process_id = 0; 783 int render_process_id = 0;
771 int render_widget_id = 0; 784 int render_widget_id = 0;
772 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( 785 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface(
773 params.surface_id, &render_process_id, &render_widget_id)) { 786 params.surface_id, &render_process_id, &render_widget_id)) {
774 return; 787 return;
775 } 788 }
776 RenderWidgetHelper* helper = 789 RenderWidgetHelper* helper =
777 RenderWidgetHelper::FromProcessHostID(render_process_id); 790 RenderWidgetHelper::FromProcessHostID(render_process_id);
778 if (!helper) 791 if (!helper)
(...skipping 12 matching lines...) Expand all
791 params.size, 804 params.size,
792 host_id_)); 805 host_id_));
793 } 806 }
794 #endif // OS_MACOSX 807 #endif // OS_MACOSX
795 808
796 #if defined(OS_WIN) 809 #if defined(OS_WIN)
797 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( 810 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
798 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 811 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
799 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); 812 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped");
800 813
801 base::ScopedClosureRunner scoped_present_completion_runner( 814 base::ScopedClosureRunner scoped_completion_runner(
802 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForRenderer, 815 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
803 params.surface_id, 816 host_id_, params.route_id, params.surface_id, params.surface_handle,
804 base::TimeTicks(), 817 true, base::TimeTicks(), base::TimeDelta()));
805 base::TimeDelta()));
806 base::ScopedClosureRunner scoped_copy_completion_runner(
807 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
808 host_id_,
809 params.route_id,
810 params.surface_handle,
811 true));
812 818
813 gfx::PluginWindowHandle handle = 819 gfx::PluginWindowHandle handle =
814 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id); 820 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id);
815 821
816 if (!handle) { 822 if (!handle) {
817 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI", 823 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI",
818 "surface_id", params.surface_id); 824 "surface_id", params.surface_id);
819 #if defined(USE_AURA) 825 #if defined(USE_AURA)
820 // This is a content area swap, send it on to the UI thread. 826 // This is a content area swap, send it on to the UI thread.
821 scoped_copy_completion_runner.Release(); 827 scoped_completion_runner.Release();
822 scoped_present_completion_runner.Release();
823 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 828 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
824 #endif 829 #endif
825 return; 830 return;
826 } 831 }
827 832
828 // Otherwise it's the UI swap. 833 // Otherwise it's the UI swap.
829 834
830 scoped_refptr<AcceleratedPresenter> presenter( 835 scoped_refptr<AcceleratedPresenter> presenter(
831 AcceleratedPresenter::GetForWindow(handle)); 836 AcceleratedPresenter::GetForWindow(handle));
832 if (!presenter) { 837 if (!presenter) {
833 TRACE_EVENT1("gpu", "EarlyOut_NativeWindowNotFound", "handle", handle); 838 TRACE_EVENT1("gpu", "EarlyOut_NativeWindowNotFound", "handle", handle);
834 return; 839 return;
835 } 840 }
836 841
837 scoped_copy_completion_runner.Release(); 842 scoped_completion_runner.Release();
838 scoped_present_completion_runner.Release();
839 presenter->AsyncPresentAndAcknowledge( 843 presenter->AsyncPresentAndAcknowledge(
840 params.size, 844 params.size,
841 params.surface_handle, 845 params.surface_handle,
842 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, 846 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
843 host_id_, 847 host_id_,
844 params.route_id, 848 params.route_id,
845 params.surface_handle), 849 params.surface_id,
846 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForRenderer, 850 params.surface_handle));
847 params.surface_id));
848 } 851 }
849 852
850 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer( 853 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer(
851 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { 854 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
852 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer"); 855 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer");
853 856
854 NOTIMPLEMENTED(); 857 NOTIMPLEMENTED();
855 } 858 }
856 859
857 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) { 860 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 void GpuProcessHost::BlockLiveOffscreenContexts() { 1046 void GpuProcessHost::BlockLiveOffscreenContexts() {
1044 for (std::multiset<GURL>::iterator iter = 1047 for (std::multiset<GURL>::iterator iter =
1045 urls_with_live_offscreen_contexts_.begin(); 1048 urls_with_live_offscreen_contexts_.begin();
1046 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { 1049 iter != urls_with_live_offscreen_contexts_.end(); ++iter) {
1047 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( 1050 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(
1048 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); 1051 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN);
1049 } 1052 }
1050 } 1053 }
1051 1054
1052 } // namespace content 1055 } // 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