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

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

Issue 11194042: Implement TextureImageTransportSurface using texture mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win_aura DCHECK() Created 8 years 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
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 21 matching lines...) Expand all
152 if (!rwh) 152 if (!rwh)
153 return; 153 return;
154 RenderWidgetHostImpl::From(rwh)->AcknowledgeSwapBuffersToRenderer(); 154 RenderWidgetHostImpl::From(rwh)->AcknowledgeSwapBuffersToRenderer();
155 if (interval != base::TimeDelta()) 155 if (interval != base::TimeDelta())
156 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval); 156 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval);
157 } 157 }
158 158
159 void AcceleratedSurfaceBuffersSwappedCompleted(int host_id, 159 void AcceleratedSurfaceBuffersSwappedCompleted(int host_id,
160 int route_id, 160 int route_id,
161 int surface_id, 161 int surface_id,
162 uint64 surface_handle,
162 bool alive, 163 bool alive,
163 base::TimeTicks timebase, 164 base::TimeTicks timebase,
164 base::TimeDelta interval) { 165 base::TimeDelta interval) {
165 AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id, 166 AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id,
166 alive, true /* presented */); 167 alive, surface_handle);
167 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase, 168 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase,
168 interval); 169 interval);
169 } 170 }
170 #endif // defined(OS_WIN) 171 #endif // defined(OS_WIN)
171 172
172 } // anonymous namespace 173 } // anonymous namespace
173 174
174 #if defined(TOOLKIT_GTK) 175 #if defined(TOOLKIT_GTK)
175 // 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
176 // 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
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no 756 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no
756 // plugin windows. 757 // plugin windows.
757 if (handle != gfx::kNullPluginWindow) { 758 if (handle != gfx::kNullPluginWindow) {
758 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 759 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
759 return; 760 return;
760 } 761 }
761 762
762 base::ScopedClosureRunner scoped_completion_runner( 763 base::ScopedClosureRunner scoped_completion_runner(
763 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, 764 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
764 host_id_, params.route_id, 765 host_id_, params.route_id,
765 true /* alive */, false /* presented */)); 766 true /* alive */, params.surface_handle));
766 767
767 int render_process_id = 0; 768 int render_process_id = 0;
768 int render_widget_id = 0; 769 int render_widget_id = 0;
769 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( 770 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface(
770 params.surface_id, &render_process_id, &render_widget_id)) { 771 params.surface_id, &render_process_id, &render_widget_id)) {
771 return; 772 return;
772 } 773 }
773 RenderWidgetHelper* helper = 774 RenderWidgetHelper* helper =
774 RenderWidgetHelper::FromProcessHostID(render_process_id); 775 RenderWidgetHelper::FromProcessHostID(render_process_id);
775 if (!helper) 776 if (!helper)
(...skipping 14 matching lines...) Expand all
790 } 791 }
791 #endif // OS_MACOSX 792 #endif // OS_MACOSX
792 793
793 #if defined(OS_WIN) 794 #if defined(OS_WIN)
794 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( 795 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
795 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 796 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
796 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); 797 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped");
797 798
798 base::ScopedClosureRunner scoped_completion_runner( 799 base::ScopedClosureRunner scoped_completion_runner(
799 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, 800 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
800 host_id_, params.route_id, params.surface_id, 801 host_id_, params.route_id, params.surface_id, params.surface_handle,
801 true, base::TimeTicks(), base::TimeDelta())); 802 true, base::TimeTicks(), base::TimeDelta()));
802 803
803 gfx::PluginWindowHandle handle = 804 gfx::PluginWindowHandle handle =
804 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id); 805 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id);
805 806
806 if (!handle) { 807 if (!handle) {
807 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI", 808 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI",
808 "surface_id", params.surface_id); 809 "surface_id", params.surface_id);
809 #if defined(USE_AURA) 810 #if defined(USE_AURA)
810 // This is a content area swap, send it on to the UI thread. 811 // This is a content area swap, send it on to the UI thread.
811 scoped_completion_runner.Release(); 812 scoped_completion_runner.Release();
(...skipping 11 matching lines...) Expand all
823 return; 824 return;
824 } 825 }
825 826
826 scoped_completion_runner.Release(); 827 scoped_completion_runner.Release();
827 presenter->AsyncPresentAndAcknowledge( 828 presenter->AsyncPresentAndAcknowledge(
828 params.size, 829 params.size,
829 params.surface_handle, 830 params.surface_handle,
830 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, 831 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
831 host_id_, 832 host_id_,
832 params.route_id, 833 params.route_id,
833 params.surface_id)); 834 params.surface_id,
835 params.surface_handle));
834 } 836 }
835 837
836 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer( 838 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer(
837 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { 839 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
838 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer"); 840 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer");
839 841
840 NOTIMPLEMENTED(); 842 NOTIMPLEMENTED();
841 } 843 }
842 844
843 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) { 845 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 void GpuProcessHost::BlockLiveOffscreenContexts() { 1051 void GpuProcessHost::BlockLiveOffscreenContexts() {
1050 for (std::multiset<GURL>::iterator iter = 1052 for (std::multiset<GURL>::iterator iter =
1051 urls_with_live_offscreen_contexts_.begin(); 1053 urls_with_live_offscreen_contexts_.begin();
1052 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { 1054 iter != urls_with_live_offscreen_contexts_.end(); ++iter) {
1053 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( 1055 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(
1054 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); 1056 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN);
1055 } 1057 }
1056 } 1058 }
1057 1059
1058 } // namespace content 1060 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/browser/gpu/gpu_process_host_ui_shim.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698