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

Unified Diff: content/browser/renderer_host/render_widget_host_view_win.cc

Issue 8060045: Use shared D3D9 texture to transport the compositor's backing buffer to the browser... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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/renderer_host/render_widget_host_view_win.cc
===================================================================
--- content/browser/renderer_host/render_widget_host_view_win.cc (revision 108480)
+++ content/browser/renderer_host/render_widget_host_view_win.cc (working copy)
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/metrics/histogram.h"
@@ -19,11 +20,14 @@
#include "content/browser/accessibility/browser_accessibility_manager.h"
#include "content/browser/accessibility/browser_accessibility_state.h"
#include "content/browser/accessibility/browser_accessibility_win.h"
+#include "content/browser/gpu/gpu_process_host.h"
+#include "content/browser/gpu/gpu_process_host_ui_shim.h"
#include "content/browser/plugin_process_host.h"
#include "content/browser/renderer_host/backing_store.h"
#include "content/browser/renderer_host/backing_store_win.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_widget_host.h"
+#include "content/common/gpu/gpu_messages.h"
#include "content/common/plugin_messages.h"
#include "content/common/view_messages.h"
#include "content/public/browser/browser_thread.h"
@@ -54,6 +58,8 @@
#include "webkit/plugins/npapi/webplugin.h"
#include "webkit/plugins/npapi/webplugin_delegate_impl.h"
+#pragma comment(lib, "d3d9.lib")
+
using base::TimeDelta;
using base::TimeTicks;
using content::BrowserThread;
@@ -203,6 +209,21 @@
return ::DefWindowProc(window, message, wparam, lparam);
}
+void SendToGpuProcessHost(int gpu_host_id, IPC::Message* message) {
+ GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id);
+ if (!gpu_process_host) {
+ delete message;
+ return;
+ }
+
+ gpu_process_host->Send(message);
+}
+
+void PostTaskOnIOThread(const tracked_objects::Location& from_here,
+ base::Closure task) {
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, task);
+}
+
bool DecodeZoomGesture(HWND hwnd, const GESTUREINFO& gi,
content::PageZoom* zoom,
POINT* zoom_center) {
@@ -324,6 +345,9 @@
RenderWidgetHostViewWin::~RenderWidgetHostViewWin() {
UnlockMouse();
ResetTooltip();
+
+ if (accelerated_surface_)
+ accelerated_surface_->Destroy();
}
void RenderWidgetHostViewWin::CreateWnd(HWND parent) {
@@ -1750,8 +1774,14 @@
}
void RenderWidgetHostViewWin::ScheduleComposite() {
- if (render_widget_host_)
- render_widget_host_->ScheduleComposite();
+ // If we have a previous frame then present it immediately. Otherwise request
+ // a new frame be composited.
+ if (accelerated_surface_.get()) {
+ accelerated_surface_->Present();
+ } else {
+ if (render_widget_host_)
+ render_widget_host_->ScheduleComposite();
+ }
}
// Creates a HWND within the RenderWidgetHostView that will serve as a host
@@ -1846,6 +1876,27 @@
}
}
+void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped(
+ const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
+ int gpu_host_id) {
+ if (!accelerated_surface_.get() && compositor_host_window_) {
+ accelerated_surface_ = new AcceleratedSurface(compositor_host_window_);
+ accelerated_surface_->Initialize();
+ }
+
+ base::Closure acknowledge_task =
+ base::Bind(SendToGpuProcessHost,
+ gpu_host_id,
+ new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id));
+
+ accelerated_surface_->AsyncPresentAndAcknowledge(
+ params.size,
+ params.surface_id,
+ base::Bind(PostTaskOnIOThread,
+ FROM_HERE,
+ acknowledge_task));
+}
+
void RenderWidgetHostViewWin::SetAccessibilityFocus(int acc_obj_id) {
if (!render_widget_host_)
return;
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.h ('k') | content/browser/renderer_host/test_render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698