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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 396483003: Separate ResizeHelper from RenderWidgetHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Linux build again 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_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 1c1eb3b6e9f1ba04f3b1d4bd43c86a8c6e943278..1c9f5a6f1d4f719992764e569e69e0e7c1f83211 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -70,6 +70,10 @@
#include "ui/gfx/vector2d_conversions.h"
#include "ui/snapshot/snapshot.h"
+#if defined(OS_MACOSX)
+#include "content/browser/renderer_host/render_widget_resize_helper_mac.h"
+#endif
+
#if defined(OS_WIN)
#include "content/common/plugin_constants_win.h"
#endif
@@ -89,12 +93,6 @@ namespace {
bool g_check_for_pending_resize_ack = true;
-// How long to (synchronously) wait for the renderer to respond with a
-// PaintRect message, when our backing-store is invalid, before giving up and
-// returning a null or incorrectly sized backing-store from GetBackingStore.
-// This timeout impacts the "choppiness" of our window resize perf.
-const int kPaintMsgTimeoutMS = 50;
-
typedef std::pair<int32, int32> RenderWidgetHostID;
typedef base::hash_map<RenderWidgetHostID, RenderWidgetHostImpl*>
RoutingIDWidgetMap;
@@ -476,10 +474,6 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowDestroyed,
OnWindowlessPluginDummyWindowDestroyed)
#endif
-#if defined(OS_MACOSX)
- IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped,
- OnCompositorSurfaceBuffersSwapped)
-#endif
#if defined(OS_MACOSX) || defined(USE_AURA)
IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged,
OnImeCompositionRangeChanged)
@@ -710,6 +704,7 @@ void RenderWidgetHostImpl::UnlockBackingStore() {
}
#endif
+#if defined(OS_MACOSX)
void RenderWidgetHostImpl::PauseForPendingResizeOrRepaints() {
TRACE_EVENT0("browser",
"RenderWidgetHostImpl::PauseForPendingResizeOrRepaints");
@@ -735,6 +730,11 @@ bool RenderWidgetHostImpl::CanPauseForPendingResizeOrRepaints() {
void RenderWidgetHostImpl::WaitForSurface() {
TRACE_EVENT0("browser", "RenderWidgetHostImpl::WaitForSurface");
+ // How long to (synchronously) wait for the renderer to respond with a
+ // new frame when our current frame doesn't exist or is the wrong size.
+ // This timeout impacts the "choppiness" of our window resize.
+ const int kPaintMsgTimeoutMS = 50;
+
if (!view_)
return;
@@ -792,8 +792,7 @@ void RenderWidgetHostImpl::WaitForSurface() {
// on a response, block for a little while to see if we can't get a response
// before returning the old (incorrectly sized) backing store.
IPC::Message msg;
- if (process_->WaitForBackingStoreMsg(routing_id_, max_delay, &msg)) {
- OnMessageReceived(msg);
+ if (RenderWidgetResizeHelper::Get()->WaitForSingleTaskToRun(max_delay)) {
// For auto-resized views, current_size_ determines the view_size and it
// may have changed during the handling of an UpdateRect message.
@@ -816,6 +815,7 @@ void RenderWidgetHostImpl::WaitForSurface() {
max_delay = end_time - TimeTicks::Now();
} while (max_delay > TimeDelta::FromSeconds(0));
}
+#endif
bool RenderWidgetHostImpl::ScheduleComposite() {
if (is_hidden_ || current_size_.IsEmpty() || repaint_ack_pending_ ||
@@ -1413,43 +1413,6 @@ void RenderWidgetHostImpl::OnRequestMove(const gfx::Rect& pos) {
}
}
-#if defined(OS_MACOSX)
-void RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped(
- const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) {
- // This trace event is used in
- // chrome/browser/extensions/api/cast_streaming/performance_test.cc
- TRACE_EVENT0("renderer_host",
- "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped");
- // This trace event is used in
- // chrome/browser/extensions/api/cast_streaming/performance_test.cc
- UNSHIPPED_TRACE_EVENT0("test_fps",
- TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame"));
- if (!ui::LatencyInfo::Verify(params.latency_info,
- "ViewHostMsg_CompositorSurfaceBuffersSwapped"))
- return;
- if (!view_) {
- AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
- ack_params.sync_point = 0;
- RenderWidgetHostImpl::AcknowledgeBufferPresent(params.route_id,
- params.gpu_process_host_id,
- ack_params);
- return;
- }
- GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params gpu_params;
- gpu_params.surface_id = params.surface_id;
- gpu_params.surface_handle = params.surface_handle;
- gpu_params.route_id = params.route_id;
- gpu_params.size = params.size;
- gpu_params.scale_factor = params.scale_factor;
- gpu_params.latency_info = params.latency_info;
- for (size_t i = 0; i < gpu_params.latency_info.size(); i++)
- AddLatencyInfoComponentIds(&gpu_params.latency_info[i]);
- view_->AcceleratedSurfaceBuffersSwapped(gpu_params,
- params.gpu_process_host_id);
- view_->DidReceiveRendererFrame();
-}
-#endif // OS_MACOSX
-
bool RenderWidgetHostImpl::OnSwapCompositorFrame(
const IPC::Message& message) {
// This trace event is used in

Powered by Google App Engine
This is Rietveld 408576698