| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_H__ | 5 #ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_H_ |
| 6 #define CHROME_BROWSER_RENDER_WIDGET_HOST_H__ | 6 #define CHROME_BROWSER_RENDER_WIDGET_HOST_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "base/task.h" | |
| 11 #include "base/gfx/size.h" | 10 #include "base/gfx/size.h" |
| 11 #include "base/timer.h" |
| 12 #include "chrome/common/ipc_channel.h" | 12 #include "chrome/common/ipc_channel.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Rect; | 15 class Rect; |
| 16 } | 16 } |
| 17 | 17 |
| 18 class BackingStore; | 18 class BackingStore; |
| 19 class PaintObserver; | 19 class PaintObserver; |
| 20 class RenderProcessHost; | 20 class RenderProcessHost; |
| 21 class RenderWidgetHostView; | 21 class RenderWidgetHostView; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 class PaintObserver; | 173 class PaintObserver; |
| 174 // Set the PaintObserver on this object. Takes ownership. | 174 // Set the PaintObserver on this object. Takes ownership. |
| 175 void SetPaintObserver(PaintObserver* paint_observer) { | 175 void SetPaintObserver(PaintObserver* paint_observer) { |
| 176 paint_observer_.reset(paint_observer); | 176 paint_observer_.reset(paint_observer); |
| 177 } | 177 } |
| 178 | 178 |
| 179 // Checks to see if we can give up focus to this widget through a | 179 // Checks to see if we can give up focus to this widget through a |
| 180 // javascript call. | 180 // javascript call. |
| 181 virtual bool CanBlur() const { return true; } | 181 virtual bool CanBlur() const { return true; } |
| 182 | 182 |
| 183 // Restart the active hang monitor timeout. Clears all existing timeouts | 183 // Restart the active hang monitor timeout. Clears all existing timeouts and |
| 184 // and starts with a new one. | 184 // starts with a new one. This can be because the renderer has become |
| 185 // This can be because the renderer has become active, the tab is being | 185 // active, the tab is being hidden, or the user has chosen to wait some more |
| 186 // hidden, or the user has chosen to wait some more to give the tab a chance | 186 // to give the tab a chance to become active and we don't want to display a |
| 187 // to become active and we don't want to display a warning too soon. | 187 // warning too soon. |
| 188 void RestartHangMonitorTimeout(); | 188 void RestartHangMonitorTimeout(); |
| 189 | 189 |
| 190 // Stops all existing hang monitor timeouts and assumes the renderer is | 190 // Stops all existing hang monitor timeouts and assumes the renderer is |
| 191 // responsive. | 191 // responsive. |
| 192 void StopHangMonitorTimeout(); | 192 void StopHangMonitorTimeout(); |
| 193 | 193 |
| 194 // Starts a hang monitor timeout. If there's already a hang monitor timeout | 194 // Starts a hang monitor timeout. If there's already a hang monitor timeout |
| 195 // the new one will only fire if it has a shorter delay than the time | 195 // the new one will only fire if it has a shorter delay than the time |
| 196 // left on the existing timeouts. | 196 // left on the existing timeouts. |
| 197 void StartHangMonitorTimeout(int delay); | 197 void StartHangMonitorTimeout(TimeDelta delay); |
| 198 | 198 |
| 199 // Called when we receive a notification indicating that the renderer | 199 // Called when we receive a notification indicating that the renderer |
| 200 // process has gone. | 200 // process has gone. |
| 201 void RendererExited(); | 201 void RendererExited(); |
| 202 | 202 |
| 203 // Called when the system theme changes. At this time all existing native | 203 // Called when the system theme changes. At this time all existing native |
| 204 // theme handles are invalid and the renderer must obtain new ones and | 204 // theme handles are invalid and the renderer must obtain new ones and |
| 205 // repaint. | 205 // repaint. |
| 206 void SystemThemeChanged(); | 206 void SystemThemeChanged(); |
| 207 | 207 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // Called to scroll a region of the backing store | 243 // Called to scroll a region of the backing store |
| 244 void ScrollRect(HANDLE bitmap, const gfx::Rect& bitmap_rect, int dx, int dy, | 244 void ScrollRect(HANDLE bitmap, const gfx::Rect& bitmap_rect, int dx, int dy, |
| 245 const gfx::Rect& clip_rect, const gfx::Size& view_size); | 245 const gfx::Rect& clip_rect, const gfx::Size& view_size); |
| 246 | 246 |
| 247 // Tell this object to destroy itself. | 247 // Tell this object to destroy itself. |
| 248 void Destroy(); | 248 void Destroy(); |
| 249 | 249 |
| 250 // Callbacks for notification when the renderer becomes unresponsive to user | 250 // Callbacks for notification when the renderer becomes unresponsive to user |
| 251 // input events, and subsequently responsive again. The delegate can use | 251 // input events, and subsequently responsive again. The delegate can use |
| 252 // these notifications to show a warning. | 252 // these notifications to show a warning. |
| 253 void RendererIsUnresponsive(); | 253 void CheckRendererIsUnresponsive(); |
| 254 virtual void NotifyRendererUnresponsive() {} | 254 virtual void NotifyRendererUnresponsive() {} |
| 255 void RendererIsResponsive(); | 255 void RendererIsResponsive(); |
| 256 virtual void NotifyRendererResponsive() {} | 256 virtual void NotifyRendererResponsive() {} |
| 257 | 257 |
| 258 // Created during construction but initialized during Init*(). Therefore, it | 258 // Created during construction but initialized during Init*(). Therefore, it |
| 259 // is guaranteed never to be NULL, but its channel may be NULL if the | 259 // is guaranteed never to be NULL, but its channel may be NULL if the |
| 260 // renderer crashed, so you must always check that. | 260 // renderer crashed, so you must always check that. |
| 261 RenderProcessHost* process_; | 261 RenderProcessHost* process_; |
| 262 | 262 |
| 263 // The ID of the corresponding object in the Renderer Instance. | 263 // The ID of the corresponding object in the Renderer Instance. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 291 // If true, then we should not ask our view to repaint when our backingstore | 291 // If true, then we should not ask our view to repaint when our backingstore |
| 292 // is updated. | 292 // is updated. |
| 293 bool suppress_view_updating_; | 293 bool suppress_view_updating_; |
| 294 | 294 |
| 295 // If true, then we should repaint when restoring even if we have a | 295 // If true, then we should repaint when restoring even if we have a |
| 296 // backingstore. This flag is set to true if we receive a paint message | 296 // backingstore. This flag is set to true if we receive a paint message |
| 297 // while is_hidden_ to true. Even though we tell the render widget to hide | 297 // while is_hidden_ to true. Even though we tell the render widget to hide |
| 298 // itself, a paint message could already be in flight at that point. | 298 // itself, a paint message could already be in flight at that point. |
| 299 bool needs_repainting_on_restore_; | 299 bool needs_repainting_on_restore_; |
| 300 | 300 |
| 301 // The following factory is used to detect a hung renderer | 301 // The following value indicates a time in the future when we would consider |
| 302 ScopedRunnableMethodFactory<RenderWidgetHost> hung_renderer_factory_; | 302 // the renderer hung if it does not generate an appropriate response message. |
| 303 Time time_when_considered_hung_; |
| 304 |
| 305 // This timer runs to check if time_when_considered_hung_ has past. |
| 306 base::OneShotTimer<RenderWidgetHost> hung_renderer_timer_; |
| 303 | 307 |
| 304 // This is true if the renderer is currently unresponsive. | 308 // This is true if the renderer is currently unresponsive. |
| 305 bool is_unresponsive_; | 309 bool is_unresponsive_; |
| 306 | 310 |
| 307 // Optional observer that listens for notifications of painting. | 311 // Optional observer that listens for notifications of painting. |
| 308 scoped_ptr<PaintObserver> paint_observer_; | 312 scoped_ptr<PaintObserver> paint_observer_; |
| 309 | 313 |
| 310 // Set when we call DidPaintRect/DidScrollRect on the view. | 314 // Set when we call DidPaintRect/DidScrollRect on the view. |
| 311 bool view_being_painted_; | 315 bool view_being_painted_; |
| 312 | 316 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 }; | 356 }; |
| 353 | 357 |
| 354 class RenderWidgetHost::PaintObserver { | 358 class RenderWidgetHost::PaintObserver { |
| 355 public: | 359 public: |
| 356 virtual ~PaintObserver() {} | 360 virtual ~PaintObserver() {} |
| 357 | 361 |
| 358 // Called each time the RenderWidgetHost paints. | 362 // Called each time the RenderWidgetHost paints. |
| 359 virtual void RenderWidgetHostDidPaint(RenderWidgetHost* rwh) = 0; | 363 virtual void RenderWidgetHostDidPaint(RenderWidgetHost* rwh) = 0; |
| 360 }; | 364 }; |
| 361 | 365 |
| 362 #endif // #ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_H__ | 366 #endif // #ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_H_ |
| 363 | |
| OLD | NEW |