Avoid sync ipc calls for GetRootWindowRect/GetWindowRect on Android.

The sync ipc calls are expensive on Android expecially when the message loop
is busy handling both native and Java tasks. Because our simple implementation
of GetRootWindowRect/GetWindowRect in the host (both directly return
GetViewBounds() which is the same value of Rect(RenderWidget::_size)),
we are able to create short circuits of them to avoid the sync ipc calls.


Review URL: https://chromiumcodereview.appspot.com/10986030

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158674 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index d275215..35ee058 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1321,9 +1321,14 @@
   if (pending_window_rect_count_)
     return pending_window_rect_;
 
+#if defined(OS_ANDROID)
+  // Short circuit of the sync RPC call.
+  return gfx::Rect(size_);
+#else
   gfx::Rect rect;
   Send(new ViewHostMsg_GetWindowRect(routing_id_, host_window_, &rect));
   return rect;
+#endif
 }
 
 void RenderWidget::setToolTipText(const WebKit::WebString& text,
@@ -1355,9 +1360,14 @@
     return pending_window_rect_;
   }
 
+#if defined(OS_ANDROID)
+  // Short circuit of the sync RPC call.
+  return gfx::Rect(size_);
+#else
   gfx::Rect rect;
   Send(new ViewHostMsg_GetRootWindowRect(routing_id_, host_window_, &rect));
   return rect;
+#endif
 }
 
 WebRect RenderWidget::windowResizerRect() {