summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host/test
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 00:55:37 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 00:55:37 +0000
commitc0fc094f4b95fc55baace5d1452b6110f68cf167 (patch)
tree16dc1253142393c4325055ef69971fa4f91187f0 /chrome/browser/renderer_host/test
parentf0c7a263de099efa75d9f4122c16c0c0fcaa9677 (diff)
downloadchromium_src-c0fc094f4b95fc55baace5d1452b6110f68cf167.zip
chromium_src-c0fc094f4b95fc55baace5d1452b6110f68cf167.tar.gz
chromium_src-c0fc094f4b95fc55baace5d1452b6110f68cf167.tar.bz2
Add the ability for the GPU process to be used to paint the backing store of a
tab. This is the first pass and is currently a bit buggy and incomplete. This patch refactors the backing store to make it a virtual interface which is then implemented by the platform-specific backing stores. This cleans up the multi-platform aspects of the old code, and also makes it possible to create different backing stores (such as ones in another process). This renames the BackingStore::PaintRect function to PaintToBackingStore which clears up what it does. I would often get confused and think that it paints the backing store to the screen. This makes a common way to capture backing store information and adds it to the backing store API. This removed a bunch of ugly ifdefs. This adds the ability for a backing store to specify that the TransportDIB should not be freed by RenderWidgetHost when painting is complete. This is necessary since the out-of-process version needs to use it after the RenderWidget paint function has returned. This pushes up the vector of copy_rect from RenderWidgetHost to the actual BackingStores. This prevents us from sending duplicate data over IPC. It also makes the common non-IPC case more efficient, since we end up setting up various surfaces only once when there are multiple update rects. BUG=none TEST=none Review URL: http://codereview.chromium.org/523028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36075 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/test')
-rw-r--r--chrome/browser/renderer_host/test/test_backing_store.cc31
-rw-r--r--chrome/browser/renderer_host/test/test_backing_store.h31
-rw-r--r--chrome/browser/renderer_host/test/test_render_view_host.cc4
3 files changed, 64 insertions, 2 deletions
diff --git a/chrome/browser/renderer_host/test/test_backing_store.cc b/chrome/browser/renderer_host/test/test_backing_store.cc
new file mode 100644
index 0000000..d90c7fd
--- /dev/null
+++ b/chrome/browser/renderer_host/test/test_backing_store.cc
@@ -0,0 +1,31 @@
+// Copyright (c) 2010 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.
+
+#include "chrome/browser/renderer_host/test/test_backing_store.h"
+
+TestBackingStore::TestBackingStore(RenderWidgetHost* widget,
+ const gfx::Size& size)
+ : BackingStore(widget, size) {
+}
+
+TestBackingStore::~TestBackingStore() {
+}
+
+void TestBackingStore::PaintToBackingStore(
+ RenderProcessHost* process,
+ TransportDIB::Id bitmap,
+ const gfx::Rect& bitmap_rect,
+ const std::vector<gfx::Rect>& copy_rects,
+ bool* painted_synchronously) {
+}
+
+bool TestBackingStore::CopyFromBackingStore(const gfx::Rect& rect,
+ skia::PlatformCanvas* output) {
+ return false;
+}
+
+void TestBackingStore::ScrollBackingStore(int dx, int dy,
+ const gfx::Rect& clip_rect,
+ const gfx::Size& view_size) {
+}
diff --git a/chrome/browser/renderer_host/test/test_backing_store.h b/chrome/browser/renderer_host/test/test_backing_store.h
new file mode 100644
index 0000000..41deb4c
--- /dev/null
+++ b/chrome/browser/renderer_host/test/test_backing_store.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2010 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.
+
+#ifndef CHROME_BROWSER_RENDERER_HOST_TEST_TEST_BACKING_STORE_H_
+#define CHROME_BROWSER_RENDERER_HOST_TEST_TEST_BACKING_STORE_H_
+
+#include "base/basictypes.h"
+#include "chrome/browser/renderer_host/backing_store.h"
+
+class TestBackingStore : public BackingStore {
+ public:
+ TestBackingStore(RenderWidgetHost* widget, const gfx::Size& size);
+ virtual ~TestBackingStore();
+
+ // BackingStore implementation.
+ virtual void PaintToBackingStore(RenderProcessHost* process,
+ TransportDIB::Id bitmap,
+ const gfx::Rect& bitmap_rect,
+ const std::vector<gfx::Rect>& copy_rects,
+ bool* painted_synchronously);
+ virtual bool CopyFromBackingStore(const gfx::Rect& rect,
+ skia::PlatformCanvas* output);
+ virtual void ScrollBackingStore(int dx, int dy,
+ const gfx::Rect& clip_rect,
+ const gfx::Size& view_size);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestBackingStore);
+};
+
+#endif // CHROME_BROWSER_RENDERER_HOST_TEST_TEST_BACKING_STORE_H_
diff --git a/chrome/browser/renderer_host/test/test_render_view_host.cc b/chrome/browser/renderer_host/test/test_render_view_host.cc
index 720f51e..095c2e1 100644
--- a/chrome/browser/renderer_host/test/test_render_view_host.cc
+++ b/chrome/browser/renderer_host/test/test_render_view_host.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "base/gfx/rect.h"
-#include "chrome/browser/renderer_host/backing_store.h"
+#include "chrome/browser/renderer_host/test/test_backing_store.h"
#include "chrome/browser/tab_contents/test_tab_contents.h"
#include "chrome/common/render_messages.h"
@@ -74,7 +74,7 @@ TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh)
BackingStore* TestRenderWidgetHostView::AllocBackingStore(
const gfx::Size& size) {
- return new BackingStore(rwh_, size);
+ return new TestBackingStore(rwh_, size);
}
#if defined(OS_MACOSX)