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

Unified Diff: content/browser/renderer_host/render_widget_helper.h

Issue 396483003: Separate ResizeHelper from RenderWidgetHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make dtor order more robust Created 6 years, 5 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: content/browser/renderer_host/render_widget_helper.h
diff --git a/content/browser/renderer_host/render_widget_helper.h b/content/browser/renderer_host/render_widget_helper.h
index e424c764df73ffb5dab6ee02962a5de72a0a2476..54e5c9f51b121fea63d0f09cac700a10ff2a008a 100644
--- a/content/browser/renderer_host/render_widget_helper.h
+++ b/content/browser/renderer_host/render_widget_helper.h
@@ -5,15 +5,12 @@
#ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_
#define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_
-#include <deque>
#include <map>
#include "base/atomic_sequence_num.h"
#include "base/containers/hash_tables.h"
#include "base/memory/ref_counted.h"
#include "base/process/process.h"
-#include "base/synchronization/lock.h"
-#include "base/synchronization/waitable_event.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/global_request_id.h"
@@ -45,38 +42,6 @@ class SessionStorageNamespace;
// the RenderWidgetHost lives.
//
//
-// OPTIMIZED RESIZE
-//
-// RenderWidgetHelper is used to implement optimized resize. When the
-// RenderWidgetHost is resized, it sends a Resize message to its RenderWidget
-// counterpart in the renderer process. In response to the Resize message,
-// the RenderWidget generates a new BackingStore and sends an UpdateRect
-// message (or BuffersSwapped via the GPU process in the case of accelerated
-// compositing), and it sets the IS_RESIZE_ACK flag in the UpdateRect message
-// to true. In the accelerated case, an UpdateRect is still sent from the
-// renderer to the browser with acks and plugin moves even though the GPU
-// BackingStore was sent earlier in the BuffersSwapped message. "BackingStore
-// message" is used throughout this code and documentation to mean either a
-// software UpdateRect or GPU BuffersSwapped message.
-//
-// Back in the browser process, when the RenderProcessHost's MessageFilter
-// sees an UpdateRect message (or when the GpuProcessHost sees a
-// BuffersSwapped message), it directs it to the RenderWidgetHelper by calling
-// the DidReceiveBackingStoreMsg method. That method stores the data for the
-// message in a map, where it can be directly accessed by the RenderWidgetHost
-// on the UI thread during a call to RenderWidgetHost's GetBackingStore
-// method.
-//
-// When the RenderWidgetHost's GetBackingStore method is called, it first
-// checks to see if it is waiting for a resize ack. If it is, then it calls
-// the RenderWidgetHelper's WaitForBackingStoreMsg to check if there is
-// already a resulting BackingStore message (or to wait a short amount of time
-// for one to arrive). The main goal of this mechanism is to short-cut the
-// usual way in which IPC messages are proxied over to the UI thread via
-// InvokeLater. This approach is necessary since window resize is followed up
-// immediately by a request to repaint the window.
-//
-//
// OPTIMIZED TAB SWITCHING
//
// When a RenderWidgetHost is in a background tab, it is flagged as hidden.
@@ -104,6 +69,7 @@ class SessionStorageNamespace;
// allocation and maintains the set of allocated transport DIBs which the
// renderers can refer to.
//
+
class RenderWidgetHelper
: public base::RefCountedThreadSafe<RenderWidgetHelper,
BrowserThread::DeleteOnIOThread> {
@@ -130,17 +96,17 @@ class RenderWidgetHelper
// for documentation.
void ResumeDeferredNavigation(const GlobalRequestID& request_id);
void ResumeResponseDeferredAtStart(const GlobalRequestID& request_id);
- bool WaitForBackingStoreMsg(int render_widget_id,
- const base::TimeDelta& max_delay,
- IPC::Message* msg);
+
// Called to resume the requests for a view after it's ready. The view was
// created by CreateNewWindow which initially blocked the requests.
void ResumeRequestsForView(int route_id);
- // IO THREAD ONLY -----------------------------------------------------------
+#if defined(OS_MACOSX)
+ static void OnNativeSurfaceBuffersSwappedOnUIThread(
+ const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
+#endif
- // Called on the IO thread when a BackingStore message is received.
- void DidReceiveBackingStoreMsg(const IPC::Message& msg);
+ // IO THREAD ONLY -----------------------------------------------------------
void CreateNewWindow(
const ViewHostMsg_CreateWindow_Params& params,
@@ -170,34 +136,13 @@ class RenderWidgetHelper
void FreeTransportDIB(TransportDIB::Id dib_id);
#endif
-#if defined(OS_MACOSX)
- static void OnNativeSurfaceBuffersSwappedOnIOThread(
- GpuProcessHost* gpu_process_host,
- const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
-#endif
-
private:
- // A class used to proxy a paint message. PaintMsgProxy objects are created
- // on the IO thread and destroyed on the UI thread.
- class BackingStoreMsgProxy;
- friend class BackingStoreMsgProxy;
friend class base::RefCountedThreadSafe<RenderWidgetHelper>;
friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
friend class base::DeleteHelper<RenderWidgetHelper>;
- typedef std::deque<BackingStoreMsgProxy*> BackingStoreMsgProxyQueue;
- // Map from render_widget_id to a queue of live PaintMsgProxy instances.
- typedef base::hash_map<int, BackingStoreMsgProxyQueue >
- BackingStoreMsgProxyMap;
-
~RenderWidgetHelper();
- // Called on the UI thread to discard a paint message.
- void OnDiscardBackingStoreMsg(BackingStoreMsgProxy* proxy);
-
- // Called on the UI thread to dispatch a paint message if necessary.
- void OnDispatchBackingStoreMsg(BackingStoreMsgProxy* proxy);
-
// Called on the UI thread to finish creating a window.
void OnCreateWindowOnUI(
const ViewHostMsg_CreateWindow_Params& params,
@@ -234,18 +179,8 @@ class RenderWidgetHelper
std::map<TransportDIB::Id, int> allocated_dibs_;
#endif
- // A map of live paint messages. Must hold pending_paints_lock_ to access.
- // The BackingStoreMsgProxy objects are not owned by this map. (See
- // BackingStoreMsgProxy for details about how the lifetime of instances are
- // managed.)
- BackingStoreMsgProxyMap pending_paints_;
- base::Lock pending_paints_lock_;
-
int render_process_id_;
- // Event used to implement WaitForBackingStoreMsg.
- base::WaitableEvent event_;
-
// The next routing id to use.
base::AtomicSequenceNumber next_routing_id_;
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/browser/renderer_host/render_widget_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698