summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-06 01:54:04 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-06 01:54:04 +0000
commit842f1065260257d1cdf679b10102b7b114881a11 (patch)
treed65e43163b4a5970d46af43d96f38a289d841ec9
parent9ab5d4be70887e65a0dabce81dbff81fe9588116 (diff)
downloadchromium_src-842f1065260257d1cdf679b10102b7b114881a11.zip
chromium_src-842f1065260257d1cdf679b10102b7b114881a11.tar.gz
chromium_src-842f1065260257d1cdf679b10102b7b114881a11.tar.bz2
Reland r124453. The change was reverted in 140030 to be merged with M20.
Original CL: --- WebWidgetClient::screenInfo() no longer does a synchronous IPC. Instead it grabs the necessary info from a cached WebScreenInfo factory. BUG=111401 TEST=Manually Review URL: https://chromiumcodereview.appspot.com/10536012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140691 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/renderer_host/render_message_filter.cc1
-rw-r--r--content/browser/renderer_host/render_message_filter.h2
-rw-r--r--content/browser/renderer_host/render_message_filter_win.cc6
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc14
-rw-r--r--content/browser/renderer_host/render_widget_host_impl.cc9
-rw-r--r--content/browser/renderer_host/render_widget_host_impl.h2
-rw-r--r--content/common/view_messages.h10
-rw-r--r--content/renderer/browser_plugin/browser_plugin_channel_manager.cc1
-rw-r--r--content/renderer/render_thread_impl.cc1
-rw-r--r--content/renderer/render_view_impl.cc8
-rw-r--r--content/renderer/render_view_impl.h2
-rw-r--r--content/renderer/render_widget.cc21
-rw-r--r--content/renderer/render_widget.h7
-rw-r--r--content/renderer/render_widget_fullscreen.cc2
-rw-r--r--content/test/render_view_test.cc2
15 files changed, 42 insertions, 46 deletions
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 1abd8ab..b345caa 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -340,7 +340,6 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
// On Windows, we handle these on the IO thread to avoid a deadlock with
// plugins. On non-Windows systems, we need to handle them on the UI
// thread.
- IPC_MESSAGE_HANDLER(ViewHostMsg_GetScreenInfo, OnGetScreenInfo)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnGetWindowRect)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnGetRootWindowRect)
#endif
diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h
index d2386e7..ab54ac3 100644
--- a/content/browser/renderer_host/render_message_filter.h
+++ b/content/browser/renderer_host/render_message_filter.h
@@ -144,8 +144,6 @@ class RenderMessageFilter : public content::BrowserMessageFilter {
#if defined(OS_WIN) && !defined(USE_AURA)
// On Windows, we handle these on the IO thread to avoid a deadlock with
// plugins. On non-Windows systems, we need to handle them on the UI thread.
- void OnGetScreenInfo(gfx::NativeViewId window,
- WebKit::WebScreenInfo* results);
void OnGetWindowRect(gfx::NativeViewId window, gfx::Rect* rect);
void OnGetRootWindowRect(gfx::NativeViewId window, gfx::Rect* rect);
#endif
diff --git a/content/browser/renderer_host/render_message_filter_win.cc b/content/browser/renderer_host/render_message_filter_win.cc
index a469875..9b58562 100644
--- a/content/browser/renderer_host/render_message_filter_win.cc
+++ b/content/browser/renderer_host/render_message_filter_win.cc
@@ -49,9 +49,3 @@ void RenderMessageFilter::OnGetRootWindowRect(gfx::NativeViewId window_id,
*rect = GetVisibleWindowRect(GetAncestor(gfx::NativeViewFromId(window_id),
GA_ROOT));
}
-
-void RenderMessageFilter::OnGetScreenInfo(gfx::NativeViewId view,
- WebKit::WebScreenInfo* results) {
- *results =
- WebKit::WebScreenInfoFactory::screenInfo(gfx::NativeViewFromId(view));
-}
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 1cf2f60..b79e34d 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -64,6 +64,7 @@
#if defined(OS_WIN)
#include "base/win/windows_version.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFactory.h"
#elif defined(OS_MACOSX)
#include "content/browser/renderer_host/popup_menu_helper_mac.h"
#endif
@@ -248,6 +249,19 @@ bool RenderViewHostImpl::CreateRenderView(
params.opener_route_id = opener_route_id;
params.swapped_out = is_swapped_out_;
params.next_page_id = next_page_id;
+#if defined(OS_POSIX) || defined(USE_AURA)
+ if (GetView()) {
+ static_cast<content::RenderWidgetHostViewPort*>(
+ GetView())->GetScreenInfo(&params.screen_info);
+ } else {
+ content::RenderWidgetHostViewPort::GetDefaultScreenInfo(
+ &params.screen_info);
+ }
+#else
+ params.screen_info =
+ WebKit::WebScreenInfoFactory::screenInfo(
+ gfx::NativeViewFromId(GetNativeViewId()));
+#endif
params.embedder_channel_name = embedder_channel_name;
params.embedder_container_id = embedder_container_id;
params.accessibility_mode =
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 0ab7fe6..6a542e0 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -293,7 +293,6 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnMsgLockMouse)
IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnMsgUnlockMouse)
#if defined(OS_POSIX) || defined(USE_AURA)
- IPC_MESSAGE_HANDLER(ViewHostMsg_GetScreenInfo, OnMsgGetScreenInfo)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnMsgGetWindowRect)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnMsgGetRootWindowRect)
#endif
@@ -1562,14 +1561,6 @@ void RenderWidgetHostImpl::OnMsgUnlockMouse() {
}
#if defined(OS_POSIX) || defined(USE_AURA)
-void RenderWidgetHostImpl::OnMsgGetScreenInfo(gfx::NativeViewId window_id,
- WebKit::WebScreenInfo* results) {
- if (view_)
- view_->GetScreenInfo(results);
- else
- RenderWidgetHostViewPort::GetDefaultScreenInfo(results);
-}
-
void RenderWidgetHostImpl::OnMsgGetWindowRect(gfx::NativeViewId window_id,
gfx::Rect* results) {
if (view_)
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index 5deac12..f1ac5eb 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -494,8 +494,6 @@ class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost,
void OnMsgUnlockMouse();
#if defined(OS_POSIX) || defined(USE_AURA)
- void OnMsgGetScreenInfo(gfx::NativeViewId view,
- WebKit::WebScreenInfo* results);
void OnMsgGetWindowRect(gfx::NativeViewId window_id, gfx::Rect* results);
void OnMsgGetRootWindowRect(gfx::NativeViewId window_id, gfx::Rect* results);
#endif
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index c1beab6..3b95565 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -684,6 +684,9 @@ IPC_STRUCT_BEGIN(ViewMsg_New_Params)
// to a view and are only updated by the renderer after this initial value.
IPC_STRUCT_MEMBER(int32, next_page_id)
+ // The properties of the screen associated with the view.
+ IPC_STRUCT_MEMBER(WebKit::WebScreenInfo, screen_info)
+
// The name of the channel with which a guest talks to its embedder.
// If this newly created RenderView has no embedder this string will be
// empty.
@@ -1767,13 +1770,6 @@ IPC_SYNC_MESSAGE_CONTROL1_3(ViewHostMsg_LoadFont,
uint32 /* font id */)
#endif
-// Returns WebScreenInfo corresponding to the view.
-// TODO(shess): Provide a mapping from reply_msg->routing_id() to
-// HWND so that we can eliminate the NativeViewId parameter.
-IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetScreenInfo,
- gfx::NativeViewId /* view */,
- WebKit::WebScreenInfo /* results */)
-
// Send the tooltip text for the current mouse position to the browser.
IPC_MESSAGE_ROUTED2(ViewHostMsg_SetTooltipText,
string16 /* tooltip text string */,
diff --git a/content/renderer/browser_plugin/browser_plugin_channel_manager.cc b/content/renderer/browser_plugin/browser_plugin_channel_manager.cc
index b4f5c03..678af1c 100644
--- a/content/renderer/browser_plugin/browser_plugin_channel_manager.cc
+++ b/content/renderer/browser_plugin/browser_plugin_channel_manager.cc
@@ -60,6 +60,7 @@ void BrowserPluginChannelManager::CreateRenderView(
false,
params.swapped_out,
params.next_page_id,
+ params.screen_info,
channel,
params.accessibility_mode);
ReportChannelToEmbedder(render_view,
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 04a97b2..3f6756a 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -894,6 +894,7 @@ void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) {
false,
params.swapped_out,
params.next_page_id,
+ params.screen_info,
NULL,
params.accessibility_mode);
}
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 3ccce02..74195bd 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -504,9 +504,10 @@ RenderViewImpl::RenderViewImpl(
bool is_renderer_created,
bool swapped_out,
int32 next_page_id,
+ const WebKit::WebScreenInfo& screen_info,
content::GuestToEmbedderChannel* guest_to_embedder_channel,
AccessibilityMode accessibility_mode)
- : RenderWidget(WebKit::WebPopupTypeNone, swapped_out),
+ : RenderWidget(WebKit::WebPopupTypeNone, screen_info, swapped_out),
webkit_preferences_(webkit_prefs),
send_content_state_immediately_(false),
enabled_bindings_(0),
@@ -727,6 +728,7 @@ RenderViewImpl* RenderViewImpl::Create(
bool is_renderer_created,
bool swapped_out,
int32 next_page_id,
+ const WebKit::WebScreenInfo& screen_info,
content::GuestToEmbedderChannel* guest_to_embedder_channel,
AccessibilityMode accessibility_mode) {
DCHECK(routing_id != MSG_ROUTING_NONE);
@@ -743,6 +745,7 @@ RenderViewImpl* RenderViewImpl::Create(
is_renderer_created,
swapped_out,
next_page_id,
+ screen_info,
guest_to_embedder_channel,
accessibility_mode);
}
@@ -1648,6 +1651,7 @@ WebView* RenderViewImpl::createView(
true,
false,
1,
+ screen_info_,
guest_to_embedder_channel_,
accessibility_mode_);
view->opened_by_user_gesture_ = params.user_gesture;
@@ -1670,7 +1674,7 @@ WebView* RenderViewImpl::createView(
WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) {
RenderWidget* widget =
- RenderWidget::Create(routing_id_, popup_type);
+ RenderWidget::Create(routing_id_, popup_type, screen_info_);
return widget->webwidget();
}
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 2c9d561..4ad8430 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -209,6 +209,7 @@ class RenderViewImpl : public RenderWidget,
bool is_renderer_created,
bool swapped_out,
int32 next_page_id,
+ const WebKit::WebScreenInfo& screen_info,
content::GuestToEmbedderChannel* guest_to_embedder_channel,
AccessibilityMode accessibility_mode);
@@ -805,6 +806,7 @@ class RenderViewImpl : public RenderWidget,
bool is_renderer_created,
bool swapped_out,
int32 next_page_id,
+ const WebKit::WebScreenInfo& screen_info,
content::GuestToEmbedderChannel* guest_to_embedder_channel,
AccessibilityMode accessibility_mode);
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 0fa18e0..14b716e 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -72,6 +72,7 @@ using WebKit::WebWidget;
using content::RenderThread;
RenderWidget::RenderWidget(WebKit::WebPopupType popup_type,
+ const WebKit::WebScreenInfo& screen_info,
bool swapped_out)
: routing_id_(MSG_ROUTING_NONE),
surface_id_(0),
@@ -103,6 +104,7 @@ RenderWidget::RenderWidget(WebKit::WebPopupType popup_type,
is_accelerated_compositing_active_(false),
animation_update_pending_(false),
invalidation_task_posted_(false),
+ screen_info_(screen_info),
invert_(false) {
if (!swapped_out)
RenderProcess::current()->AddRefProcess();
@@ -125,10 +127,11 @@ RenderWidget::~RenderWidget() {
// static
RenderWidget* RenderWidget::Create(int32 opener_id,
- WebKit::WebPopupType popup_type) {
+ WebKit::WebPopupType popup_type,
+ const WebKit::WebScreenInfo& screen_info) {
DCHECK(opener_id != MSG_ROUTING_NONE);
scoped_refptr<RenderWidget> widget(
- new RenderWidget(popup_type, false));
+ new RenderWidget(popup_type, screen_info, false));
widget->Init(opener_id); // adds reference
return widget;
}
@@ -1663,19 +1666,7 @@ bool RenderWidget::CanComposeInline() {
}
WebScreenInfo RenderWidget::screenInfo() {
- WebScreenInfo results;
- if (host_window_set_)
- Send(new ViewHostMsg_GetScreenInfo(routing_id_, host_window_, &results));
- else {
- DLOG(WARNING) << "Unable to retrieve screen information, no host window";
-#if defined(USE_AURA)
- // TODO(backer): Remove this a temporary workaround for crbug.com/111929
- // once we get a proper fix.
- results.availableRect.width = 1000;
- results.availableRect.height = 1000;
-#endif
- }
- return results;
+ return screen_info_;
}
void RenderWidget::resetInputMethod() {
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index 9143b2f..570a6ea 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -81,7 +81,8 @@ class CONTENT_EXPORT RenderWidget
// Creates a new RenderWidget. The opener_id is the routing ID of the
// RenderView that this widget lives inside.
static RenderWidget* Create(int32 opener_id,
- WebKit::WebPopupType popup_type);
+ WebKit::WebPopupType popup_type,
+ const WebKit::WebScreenInfo& screen_info);
// Creates a WebWidget based on the popup type.
static WebKit::WebWidget* CreateWebWidget(RenderWidget* render_widget);
@@ -170,6 +171,7 @@ class CONTENT_EXPORT RenderWidget
};
RenderWidget(WebKit::WebPopupType popup_type,
+ const WebKit::WebScreenInfo& screen_info,
bool swapped_out);
virtual ~RenderWidget();
@@ -519,6 +521,9 @@ class CONTENT_EXPORT RenderWidget
// case NULL is added to the queue.
std::deque<ViewHostMsg_UpdateRect*> updates_pending_swap_;
+ // Properties of the screen hosting this RenderWidget instance.
+ WebKit::WebScreenInfo screen_info_;
+
// Set to true if we should invert all pixels.
bool invert_;
diff --git a/content/renderer/render_widget_fullscreen.cc b/content/renderer/render_widget_fullscreen.cc
index cdfddf3..dfb5c13 100644
--- a/content/renderer/render_widget_fullscreen.cc
+++ b/content/renderer/render_widget_fullscreen.cc
@@ -31,7 +31,7 @@ void RenderWidgetFullscreen::show(WebKit::WebNavigationPolicy) {
}
RenderWidgetFullscreen::RenderWidgetFullscreen()
- : RenderWidget(WebKit::WebPopupTypeNone, false) {
+ : RenderWidget(WebKit::WebPopupTypeNone, WebKit::WebScreenInfo(), false) {
}
RenderWidgetFullscreen::~RenderWidgetFullscreen() {}
diff --git a/content/test/render_view_test.cc b/content/test/render_view_test.cc
index c8e8425..b76d637 100644
--- a/content/test/render_view_test.cc
+++ b/content/test/render_view_test.cc
@@ -16,6 +16,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h"
@@ -164,6 +165,7 @@ void RenderViewTest::SetUp() {
false,
false,
1,
+ WebKit::WebScreenInfo(),
NULL,
AccessibilityModeOff);
view->AddRef();