summaryrefslogtreecommitdiffstats
path: root/chrome/gpu/gpu_view_win.h
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/gpu/gpu_view_win.h
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/gpu/gpu_view_win.h')
-rw-r--r--chrome/gpu/gpu_view_win.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/chrome/gpu/gpu_view_win.h b/chrome/gpu/gpu_view_win.h
new file mode 100644
index 0000000..30efeac8
--- /dev/null
+++ b/chrome/gpu/gpu_view_win.h
@@ -0,0 +1,102 @@
+// 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_GPU_GPU_VIEW_WIN_H_
+#define CHROME_GPU_GPU_VIEW_WIN_H_
+
+#include <atlbase.h>
+#include <atlapp.h>
+#include <atlcrack.h>
+#include <atlmisc.h>
+
+#include "app/gfx/native_widget_types.h"
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "ipc/ipc_channel.h"
+
+class GpuBackingStore;
+class GpuThread;
+
+namespace gfx {
+class Rect;
+class Size;
+}
+
+typedef CWinTraits<WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0>
+ GpuRenderWidgetHostViewWinTraits;
+
+class GpuViewWin
+ : public IPC::Channel::Listener,
+ public CWindowImpl<GpuViewWin,
+ CWindow,
+ GpuRenderWidgetHostViewWinTraits> {
+ public:
+ GpuViewWin(GpuThread* gpu_thread,
+ gfx::NativeViewId parent_window,
+ int32 routing_id);
+ ~GpuViewWin();
+
+ // IPC::Channel::Listener implementation.
+ virtual void OnMessageReceived(const IPC::Message& message);
+ virtual void OnChannelConnected(int32 peer_pid);
+ virtual void OnChannelError();
+
+ void DidScrollBackingStoreRect(int dx, int dy, const gfx::Rect& rect);
+
+ BEGIN_MSG_MAP(GpuViewWin)
+ MSG_WM_PAINT(OnPaint)
+ MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseEvent)
+ MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseEvent)
+ MESSAGE_HANDLER(WM_LBUTTONDOWN, OnMouseEvent)
+ MESSAGE_HANDLER(WM_MBUTTONDOWN, OnMouseEvent)
+ MESSAGE_HANDLER(WM_RBUTTONDOWN, OnMouseEvent)
+ MESSAGE_HANDLER(WM_LBUTTONUP, OnMouseEvent)
+ MESSAGE_HANDLER(WM_MBUTTONUP, OnMouseEvent)
+ MESSAGE_HANDLER(WM_RBUTTONUP, OnMouseEvent)
+ MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnMouseEvent)
+ MESSAGE_HANDLER(WM_MBUTTONDBLCLK, OnMouseEvent)
+ MESSAGE_HANDLER(WM_RBUTTONDBLCLK, OnMouseEvent)
+ MESSAGE_HANDLER(WM_SYSKEYDOWN, OnKeyEvent)
+ MESSAGE_HANDLER(WM_SYSKEYUP, OnKeyEvent)
+ MESSAGE_HANDLER(WM_KEYDOWN, OnKeyEvent)
+ MESSAGE_HANDLER(WM_KEYUP, OnKeyEvent)
+ MESSAGE_HANDLER(WM_MOUSEWHEEL, OnWheelEvent)
+ MESSAGE_HANDLER(WM_MOUSEHWHEEL, OnWheelEvent)
+ MESSAGE_HANDLER(WM_HSCROLL, OnWheelEvent)
+ MESSAGE_HANDLER(WM_VSCROLL, OnWheelEvent)
+ MESSAGE_HANDLER(WM_CHAR, OnKeyEvent)
+ MESSAGE_HANDLER(WM_SYSCHAR, OnKeyEvent)
+ MESSAGE_HANDLER(WM_IME_CHAR, OnKeyEvent)
+ END_MSG_MAP()
+
+ private:
+ // IPC message handlers.
+ void OnNewBackingStore(int32 routing_id, const gfx::Size& size);
+
+ // Windows message handlers.
+ void OnPaint(HDC unused_dc);
+ LRESULT OnMouseEvent(UINT message,
+ WPARAM wparam,
+ LPARAM lparam,
+ BOOL& handled);
+ LRESULT OnKeyEvent(UINT message,
+ WPARAM wparam,
+ LPARAM lparam,
+ BOOL& handled);
+ LRESULT OnWheelEvent(UINT message,
+ WPARAM wparam,
+ LPARAM lparam,
+ BOOL& handled);
+
+ GpuThread* gpu_thread_;
+ int32 routing_id_;
+
+ HWND parent_window_;
+
+ scoped_ptr<GpuBackingStore> backing_store_;
+
+ DISALLOW_COPY_AND_ASSIGN(GpuViewWin);
+};
+
+#endif // CHROME_GPU_GPU_VIEW_WIN_H_