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

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 9980016: Delete background tab IOSurfaces on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed some perf issues on mac Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/gpu/gpu_process_host.cc
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 1709a7f4b56c955cfffcec92bb6c8a74aad77f74..07465ebd157c7ed0aed7e0030bf18de148495c45 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -18,9 +18,11 @@
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/gpu/gpu_process_host_ui_shim.h"
#include "content/browser/gpu/gpu_surface_tracker.h"
+#include "content/browser/renderer_host/render_widget_helper.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/child_process_host_impl.h"
#include "content/common/gpu/gpu_messages.h"
+#include "content/common/view_messages.h"
#include "content/gpu/gpu_child_thread.h"
#include "content/gpu/gpu_process.h"
#include "content/public/browser/browser_thread.h"
@@ -410,6 +412,10 @@ bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated)
IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer)
+#if defined(OS_MACOSX)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
+ OnAcceleratedSurfaceBuffersSwapped)
+#endif
#if defined(OS_WIN) && !defined(USE_AURA)
IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
OnAcceleratedSurfaceBuffersSwapped)
@@ -535,6 +541,48 @@ void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) {
#endif // defined(TOOLKIT_GTK)
}
+#if defined(OS_MACOSX)
+void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
+ const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
+ TRACE_EVENT0("renderer",
+ "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped");
+
+ base::ScopedClosureRunner scoped_completion_runner(
+ base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
+ host_id_, params.route_id, true));
+
+ gfx::PluginWindowHandle handle =
+ GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id);
+ // Compositor window is always gfx::kNullPluginWindow.
+ // TODO(jbates) This will be removed when there are no plugin windows.
Ken Russell (switch to Gerrit) 2012/04/18 02:00:27 Here and throughout the review, for these TODOs, p
jbates 2012/04/18 23:01:58 Done.
+ if (handle != gfx::kNullPluginWindow) {
+ scoped_completion_runner.Release();
+ RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
+ return;
+ }
+
+ int render_process_id = 0;
+ int render_widget_id = 0;
+ if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface(
+ params.surface_id, &render_process_id, &render_widget_id)) {
+ return;
+ }
+ std::map<int, scoped_refptr<RenderWidgetHelper> >::const_iterator ci =
+ render_widget_helpers_.find(render_process_id);
+ if (ci == render_widget_helpers_.end())
+ return;
+
+ scoped_completion_runner.Release();
+ ViewHostMsg_UpdateRect_Params update_rect_params;
+ update_rect_params.gpu_surface_id = params.surface_id;
+ update_rect_params.gpu_surface_handle = params.surface_handle;
+ update_rect_params.gpu_route_id = params.route_id;
+ update_rect_params.gpu_process_host_id = host_id_;
+ ci->second->DidReceiveUpdateMsg(ViewHostMsg_UpdateRect(render_widget_id,
+ update_rect_params));
+}
+#endif // OS_MACOSX
+
#if defined(OS_WIN) && !defined(USE_AURA)
void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
@@ -638,6 +686,16 @@ void GpuProcessHost::ForceShutdown() {
process_->ForceShutdown();
}
+void GpuProcessHost::RegisterRenderWidgetHelper(
+ int render_process_id,
+ const scoped_refptr<RenderWidgetHelper>& render_widget_helper) {
+ render_widget_helpers_[render_process_id] = render_widget_helper;
+}
+
+void GpuProcessHost::UnregisterRenderWidgetHelper(int render_process_id) {
+ render_widget_helpers_.erase(render_process_id);
+}
+
bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) {
if (!(gpu_enabled_ &&
GpuDataManagerImpl::GetInstance()->ShouldUseSoftwareRendering()) &&

Powered by Google App Engine
This is Rietveld 408576698