summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_widget.h
diff options
context:
space:
mode:
authorcpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-26 22:53:44 +0000
committercpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-26 22:53:44 +0000
commit8085dbc8b9e61052d830762c0031dfdd1241daba (patch)
tree9bf5bfce24f5a543ab1bab80a0d0a381eb126322 /chrome/renderer/render_widget.h
parent2817ab16ff75ef6cd6d1b2bf15029c43c3f327b9 (diff)
downloadchromium_src-8085dbc8b9e61052d830762c0031dfdd1241daba.zip
chromium_src-8085dbc8b9e61052d830762c0031dfdd1241daba.tar.gz
chromium_src-8085dbc8b9e61052d830762c0031dfdd1241daba.tar.bz2
Factor out a RenderThread interface
- RenderWidget was not unit testable as it was - Adding the first ever RederWidget unit tests It is possible to do more. Taking it step by step. Review URL: http://codereview.chromium.org/4271 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2649 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_widget.h')
-rw-r--r--chrome/renderer/render_widget.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h
index ea1e4f7e..c9bdc39 100644
--- a/chrome/renderer/render_widget.h
+++ b/chrome/renderer/render_widget.h
@@ -13,11 +13,13 @@
#include "base/ref_counted.h"
#include "chrome/common/ipc_channel.h"
#include "chrome/common/render_messages.h"
-#include "chrome/renderer/render_process.h"
+
#include "webkit/glue/webwidget_delegate.h"
#include "webkit/glue/webcursor.h"
#include "webkit/glue/webplugin.h"
+class RenderThreadBase;
+
// RenderWidget provides a communication bridge between a WebWidget and
// a RenderWidgetHost, the latter of which lives in a different process.
class RenderWidget : public IPC::Channel::Listener,
@@ -26,8 +28,9 @@ class RenderWidget : public IPC::Channel::Listener,
public base::RefCounted<RenderWidget> {
public:
// Creates a new RenderWidget. The opener_id is the routing ID of the
- // RenderView that this widget lives inside.
- static RenderWidget* Create(int32 opener_id);
+ // RenderView that this widget lives inside. The render_thread is any
+ // RenderThreadBase implementation, mostly commonly RenderThread::current().
+ static RenderWidget* Create(int32 opener_id, RenderThreadBase* render_thread);
// The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if
// not yet assigned a view ID, in which case, the process MUST NOT send
@@ -55,6 +58,9 @@ class RenderWidget : public IPC::Channel::Listener,
// IPC::Message::Sender
virtual bool Send(IPC::Message* msg);
+ // True if the underlying IPC is currently sending data.
+ bool InSend() const;
+
// WebWidgetDelegate
virtual HWND GetContainingWindow(WebWidget* webwidget);
virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect);
@@ -71,14 +77,16 @@ class RenderWidget : public IPC::Channel::Listener,
virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move);
virtual void RunModal(WebWidget* webwidget) {}
- // Do not delete directly. This class is reference counted.
- virtual ~RenderWidget();
-
// Close the underlying WebWidget.
void Close();
protected:
- RenderWidget();
+ // Friend RefCounted so that the dtor can be non-public. Using this class
+ // without ref-counting is an error.
+ friend class base::RefCounted<RenderWidget>;
+
+ RenderWidget(RenderThreadBase* render_thread);
+ virtual ~RenderWidget();
// Initializes this view with the given opener. CompleteInit must be called
// later.
@@ -176,6 +184,9 @@ class RenderWidget : public IPC::Channel::Listener,
// view is.
int32 opener_id_;
+ // The thread that does our IPC.
+ RenderThreadBase* render_thread_;
+
// The position where this view should be initially shown.
gfx::Rect initial_pos_;