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

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

Issue 11475017: Revert 171569 as it broke some browser_tests on win_aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 uint64 surface_handle) { 103 bool did_swap) {
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 surface_handle)); 112 did_swap));
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, surface_handle, 0)); 120 route_id, did_swap, 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,
163 bool alive, 162 bool alive,
164 base::TimeTicks timebase, 163 base::TimeTicks timebase,
165 base::TimeDelta interval) { 164 base::TimeDelta interval) {
166 AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id, 165 AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id,
167 alive, surface_handle); 166 alive, true /* presented */);
168 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase, 167 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase,
169 interval); 168 interval);
170 } 169 }
171 #endif // defined(OS_WIN) 170 #endif // defined(OS_WIN)
172 171
173 } // anonymous namespace 172 } // anonymous namespace
174 173
175 #if defined(TOOLKIT_GTK) 174 #if defined(TOOLKIT_GTK)
176 // Used to put a lock on surfaces so that the window to which the GPU 175 // Used to put a lock on surfaces so that the window to which the GPU
177 // process is drawing to doesn't disappear while it is drawing when 176 // process is drawing to doesn't disappear while it is drawing when
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no 697 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no
699 // plugin windows. 698 // plugin windows.
700 if (handle != gfx::kNullPluginWindow) { 699 if (handle != gfx::kNullPluginWindow) {
701 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 700 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
702 return; 701 return;
703 } 702 }
704 703
705 base::ScopedClosureRunner scoped_completion_runner( 704 base::ScopedClosureRunner scoped_completion_runner(
706 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, 705 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
707 host_id_, params.route_id, 706 host_id_, params.route_id,
708 true /* alive */, params.surface_handle)); 707 true /* alive */, false /* presented */));
709 708
710 int render_process_id = 0; 709 int render_process_id = 0;
711 int render_widget_id = 0; 710 int render_widget_id = 0;
712 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( 711 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface(
713 params.surface_id, &render_process_id, &render_widget_id)) { 712 params.surface_id, &render_process_id, &render_widget_id)) {
714 return; 713 return;
715 } 714 }
716 RenderWidgetHelper* helper = 715 RenderWidgetHelper* helper =
717 RenderWidgetHelper::FromProcessHostID(render_process_id); 716 RenderWidgetHelper::FromProcessHostID(render_process_id);
718 if (!helper) 717 if (!helper)
(...skipping 14 matching lines...) Expand all
733 } 732 }
734 #endif // OS_MACOSX 733 #endif // OS_MACOSX
735 734
736 #if defined(OS_WIN) 735 #if defined(OS_WIN)
737 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( 736 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
738 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 737 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
739 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); 738 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped");
740 739
741 base::ScopedClosureRunner scoped_completion_runner( 740 base::ScopedClosureRunner scoped_completion_runner(
742 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, 741 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
743 host_id_, params.route_id, params.surface_id, params.surface_handle, 742 host_id_, params.route_id, params.surface_id,
744 true, base::TimeTicks(), base::TimeDelta())); 743 true, base::TimeTicks(), base::TimeDelta()));
745 744
746 gfx::PluginWindowHandle handle = 745 gfx::PluginWindowHandle handle =
747 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id); 746 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id);
748 747
749 if (!handle) { 748 if (!handle) {
750 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI", 749 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI",
751 "surface_id", params.surface_id); 750 "surface_id", params.surface_id);
752 #if defined(USE_AURA) 751 #if defined(USE_AURA)
753 // This is a content area swap, send it on to the UI thread. 752 // This is a content area swap, send it on to the UI thread.
754 scoped_completion_runner.Release(); 753 scoped_completion_runner.Release();
(...skipping 11 matching lines...) Expand all
766 return; 765 return;
767 } 766 }
768 767
769 scoped_completion_runner.Release(); 768 scoped_completion_runner.Release();
770 presenter->AsyncPresentAndAcknowledge( 769 presenter->AsyncPresentAndAcknowledge(
771 params.size, 770 params.size,
772 params.surface_handle, 771 params.surface_handle,
773 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, 772 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
774 host_id_, 773 host_id_,
775 params.route_id, 774 params.route_id,
776 params.surface_id, 775 params.surface_id));
777 params.surface_handle));
778 } 776 }
779 777
780 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer( 778 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer(
781 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { 779 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
782 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer"); 780 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer");
783 781
784 NOTIMPLEMENTED(); 782 NOTIMPLEMENTED();
785 } 783 }
786 784
787 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) { 785 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 const CreateCommandBufferCallback& callback, int32 route_id) { 982 const CreateCommandBufferCallback& callback, int32 route_id) {
985 callback.Run(route_id); 983 callback.Run(route_id);
986 } 984 }
987 985
988 void GpuProcessHost::CreateImageError( 986 void GpuProcessHost::CreateImageError(
989 const CreateImageCallback& callback, const gfx::Size size) { 987 const CreateImageCallback& callback, const gfx::Size size) {
990 callback.Run(size); 988 callback.Run(size);
991 } 989 }
992 990
993 } // namespace content 991 } // 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