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

Unified Diff: chrome/browser/renderer_host/render_widget_host.h

Issue 6010004: Refactor RenderWidgetHost::set_paint_observer() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove helper classes per review Created 9 years, 11 months 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: chrome/browser/renderer_host/render_widget_host.h
diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h
index 73d7fa4c265d8ead43de4c84bdcd5c6654d61d3f..2b30ee1483c1293d76c36b6aa7f05b2f627cd22e 100644
--- a/chrome/browser/renderer_host/render_widget_host.h
+++ b/chrome/browser/renderer_host/render_widget_host.h
@@ -42,7 +42,6 @@ class BackingStore;
class PaintObserver;
class RenderProcessHost;
class RenderWidgetHostView;
-class RenderWidgetHostPaintingObserver;
class TransportDIB;
class WebCursor;
struct ViewHostMsg_UpdateRect_Params;
@@ -124,14 +123,6 @@ struct ViewHostMsg_UpdateRect_Params;
class RenderWidgetHost : public IPC::Channel::Listener,
public IPC::Channel::Sender {
public:
- // An interface that gets called before and after a paint.
- class PaintObserver {
- public:
- virtual ~PaintObserver() {}
- virtual void RenderWidgetHostWillPaint(RenderWidgetHost* rhw) = 0;
- virtual void RenderWidgetHostDidPaint(RenderWidgetHost* rwh) = 0;
- };
-
// routing_id can be MSG_ROUTING_NONE, in which case the next available
// routing id is taken from the RenderProcessHost.
RenderWidgetHost(RenderProcessHost* process, int routing_id);
@@ -148,27 +139,12 @@ class RenderWidgetHost : public IPC::Channel::Listener,
int routing_id() const { return routing_id_; }
bool renderer_accessible() { return renderer_accessible_; }
- // Set the PaintObserver on this object. Takes ownership.
- void set_paint_observer(PaintObserver* paint_observer) {
- paint_observer_.reset(paint_observer);
- }
-
// Returns the property bag for this widget, where callers can add extra data
// they may wish to associate with it. Returns a pointer rather than a
// reference since the PropertyAccessors expect this.
const PropertyBag* property_bag() const { return &property_bag_; }
PropertyBag* property_bag() { return &property_bag_; }
- // The painting observer that will be called for paint events. This
- // pointer's ownership will remain with the caller and must remain valid
- // until this class is destroyed or the observer is replaced.
- RenderWidgetHostPaintingObserver* painting_observer() const {
- return painting_observer_;
- }
- void set_painting_observer(RenderWidgetHostPaintingObserver* observer) {
- painting_observer_ = observer;
- }
-
// Called when a renderer object already been created for this host, and we
// just need to be attached to it. Used for window.open, <select> dropdown
// menus, and other times when the renderer initiates creating an object.
@@ -219,10 +195,10 @@ class RenderWidgetHost : public IPC::Channel::Listener,
// web widget to match the |page_size| and then returns the bitmap
// scaled so it matches the |desired_size|, so that the scaling
// happens on the rendering thread. When the bitmap is ready, the
- // renderer sends a PaintAtSizeACK to this host, and the painting
- // observer is notified. Note that this bypasses most of the update
- // logic that is normally invoked, and doesn't put the results into
- // the backing store.
+ // renderer sends a PaintAtSizeACK to this host, and a
+ // RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK notification is issued.
+ // Note that this bypasses most of the update logic that is normally invoked,
+ // and doesn't put the results into the backing store.
void PaintAtSize(TransportDIB::Handle dib_handle,
int tag,
const gfx::Size& page_size,
@@ -408,6 +384,15 @@ class RenderWidgetHost : public IPC::Channel::Listener,
// Activate deferred plugin handles.
void ActivateDeferredPluginHandles();
+ // Used as the details object for a
+ // RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK notification.
+ struct PaintAtSizeAckDetails {
brettw 2011/01/10 19:18:47 Since this is a type, it should go at the top of t
+ // The tag that was passed to the PaintAtSize() call that triggered this
+ // ack.
+ int tag;
+ gfx::Size size;
+ };
+
protected:
// Internal implementation of the public Forward*Event() methods.
void ForwardInputEvent(const WebKit::WebInputEvent& input_event,
@@ -554,10 +539,6 @@ class RenderWidgetHost : public IPC::Channel::Listener,
// Stores random bits of data for others to associate with this object.
PropertyBag property_bag_;
- // Observer that will be called for paint events. This may be NULL. The
- // pointer is not owned by this class.
- RenderWidgetHostPaintingObserver* painting_observer_;
-
// The ID of the corresponding object in the Renderer Instance.
int routing_id_;
@@ -637,9 +618,6 @@ class RenderWidgetHost : public IPC::Channel::Listener,
// This timer runs to check if time_when_considered_hung_ has past.
base::OneShotTimer<RenderWidgetHost> hung_renderer_timer_;
- // Optional observer that listens for notifications of painting.
- scoped_ptr<PaintObserver> paint_observer_;
-
// Flag to detect recursive calls to GetBackingStore().
bool in_get_backing_store_;

Powered by Google App Engine
This is Rietveld 408576698