summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-05 19:03:58 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-05 19:03:58 +0000
commit2547bdecf061037a17249cf8230cfcae485aa870 (patch)
tree72a5e4cff3495f1c219a3a6f069b689b259ede32 /content/browser
parent61dc220ca5e40d489a0b50d20f32e8f88e3f9f86 (diff)
downloadchromium_src-2547bdecf061037a17249cf8230cfcae485aa870.zip
chromium_src-2547bdecf061037a17249cf8230cfcae485aa870.tar.gz
chromium_src-2547bdecf061037a17249cf8230cfcae485aa870.tar.bz2
On Windows, D3D devices used to present the compositor's output are recycled.
This is because some drivers seem to crash when a D3D query object is released. To avoid crashing, the D3D device and associated query are stored in a cache to be used by future tabs. The device's swap chain is resized to 1 x 1 during this time so that memory is not wasted. In order for the D3D objects to outlive the AcceleratedSurface object, I broke them out into another class. I considered cleaning up the D3D objects at the time where the browser process terminates. That would result in a crash on browser termination, which should not impact the user. However, I went with the former approach because it is simpler. The D3D device will likely crash if it is destroyed on the main thread, the thread where the LazyInstances are cleaned up. By the time the LazyInstances are cleaned up, the only thread on which the D3D device can correctly be destroyed can likely no longer do so. BUG=108317 Review URL: http://codereview.chromium.org/9087022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/renderer_host/render_widget_host_view_win.cc12
-rw-r--r--content/browser/renderer_host/render_widget_host_view_win.h4
2 files changed, 7 insertions, 9 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
index 1120d53..6596344 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.cc
+++ b/content/browser/renderer_host/render_widget_host_view_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -328,9 +328,6 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget)
RenderWidgetHostViewWin::~RenderWidgetHostViewWin() {
UnlockMouse();
ResetTooltip();
-
- if (accelerated_surface_)
- accelerated_surface_->Destroy();
}
void RenderWidgetHostViewWin::CreateWnd(HWND parent) {
@@ -1937,7 +1934,8 @@ static LRESULT CALLBACK CompositorHostWindowProc(HWND hWnd, UINT message,
void RenderWidgetHostViewWin::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()) {
+ if (!accelerated_surface_.get() ||
+ !accelerated_surface_->Present(compositor_host_window_)) {
if (render_widget_host_)
render_widget_host_->ScheduleComposite();
}
@@ -2041,8 +2039,7 @@ void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped(
int gpu_host_id) {
if (params.surface_id) {
if (!accelerated_surface_.get() && compositor_host_window_) {
- accelerated_surface_ = new AcceleratedSurface(compositor_host_window_);
- accelerated_surface_->Initialize();
+ accelerated_surface_.reset(new AcceleratedSurface);
}
scoped_ptr<IPC::Message> message(
@@ -2053,6 +2050,7 @@ void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped(
base::Passed(&message));
accelerated_surface_->AsyncPresentAndAcknowledge(
+ compositor_host_window_,
params.size,
params.surface_id,
base::Bind(PostTaskOnIOThread,
diff --git a/content/browser/renderer_host/render_widget_host_view_win.h b/content/browser/renderer_host/render_widget_host_view_win.h
index 2a08040..6353294 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.h
+++ b/content/browser/renderer_host/render_widget_host_view_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -356,7 +356,7 @@ class RenderWidgetHostViewWin
// Presents a texture received from another process to the compositing
// window.
- scoped_refptr<AcceleratedSurface> accelerated_surface_;
+ scoped_ptr<AcceleratedSurface> accelerated_surface_;
// true if the compositor host window must be hidden after the
// software renderered view is updated.