summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoramineer@chromium.org <amineer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-15 03:48:22 +0000
committeramineer@chromium.org <amineer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-15 03:48:22 +0000
commitf9d13a81b10fe1449ddcbaa66175c4d802431ab2 (patch)
tree7a2062921140efb4ec14718aea8366dc1a5f6f7f
parent3dfce81ed5dbba8cf3602784f269d23f601946bf (diff)
downloadchromium_src-f9d13a81b10fe1449ddcbaa66175c4d802431ab2.zip
chromium_src-f9d13a81b10fe1449ddcbaa66175c4d802431ab2.tar.gz
chromium_src-f9d13a81b10fe1449ddcbaa66175c4d802431ab2.tar.bz2
Revert 276950 "Fix race in BrowserAccessibilityManagerWin creation."
Reverting on branch until fix available > Fix race in BrowserAccessibilityManagerWin creation. > > Previously, BrowserAccessibilityManagerWin needed its parent > HWND and parent IAccessible upon construction, and if RWHVA > didn't have those, it didn't create the BAMW. This resulted > in at least two races: > > * If an accessibility tree update came from the renderer > but the BAMW wasn't created because the window wasn't available, > the tree update would get discarded - possibly leading to an > assertion failure / renderer crash later on the next update > from being out of sync. > > * If we tried to create the BAMW before the LegacyRWHH existed, > we would fall through and create a BAM instead of a BAMW, > making that whole tab inaccessible. > > To fix both issues, we always create a BAMW when needed, and > we update the BAMW with the LegacyRWHH as soon as it's > available. > > BUG=372478,379019 > NOTRY=true > > Review URL: https://codereview.chromium.org/329053004 TBR=dmazzoni@chromium.org Review URL: https://codereview.chromium.org/331073002 git-svn-id: svn://svn.chromium.org/chrome/branches/2051/src@277295 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/accessibility/browser_accessibility_manager_win.cc15
-rw-r--r--content/browser/accessibility/browser_accessibility_manager_win.h2
-rw-r--r--content/browser/accessibility/browser_accessibility_win.cc5
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc39
4 files changed, 25 insertions, 36 deletions
diff --git a/content/browser/accessibility/browser_accessibility_manager_win.cc b/content/browser/accessibility/browser_accessibility_manager_win.cc
index 974b033..9aa5d4a 100644
--- a/content/browser/accessibility/browser_accessibility_manager_win.cc
+++ b/content/browser/accessibility/browser_accessibility_manager_win.cc
@@ -37,14 +37,12 @@ BrowserAccessibilityManagerWin::BrowserAccessibilityManagerWin(
BrowserAccessibilityDelegate* delegate,
BrowserAccessibilityFactory* factory)
: BrowserAccessibilityManager(initial_tree, delegate, factory),
+ parent_hwnd_(accessible_hwnd->GetParent()),
parent_iaccessible_(parent_iaccessible),
tracked_scroll_object_(NULL),
accessible_hwnd_(accessible_hwnd) {
ui::win::CreateATLModuleIfNeeded();
- if (accessible_hwnd_) {
- accessible_hwnd_->set_browser_accessibility_manager(this);
- parent_hwnd_ = accessible_hwnd->GetParent();
- }
+ accessible_hwnd_->set_browser_accessibility_manager(this);
}
BrowserAccessibilityManagerWin::~BrowserAccessibilityManagerWin() {
@@ -71,17 +69,10 @@ ui::AXTreeUpdate BrowserAccessibilityManagerWin::GetEmptyDocument() {
return update;
}
-void BrowserAccessibilityManagerWin::SetAccessibleHWND(
- LegacyRenderWidgetHostHWND* accessible_hwnd) {
- accessible_hwnd_ = accessible_hwnd;
- accessible_hwnd_->set_browser_accessibility_manager(this);
- parent_hwnd_ = accessible_hwnd->GetParent();
-}
-
void BrowserAccessibilityManagerWin::MaybeCallNotifyWinEvent(DWORD event,
LONG child_id) {
// Don't fire events if this view isn't hooked up to its parent.
- if (!parent_iaccessible() || !parent_hwnd())
+ if (!parent_iaccessible())
return;
// If on Win 7 and complete accessibility is enabled, use the fake child HWND
diff --git a/content/browser/accessibility/browser_accessibility_manager_win.h b/content/browser/accessibility/browser_accessibility_manager_win.h
index 90914db..18260e4 100644
--- a/content/browser/accessibility/browser_accessibility_manager_win.h
+++ b/content/browser/accessibility/browser_accessibility_manager_win.h
@@ -40,8 +40,6 @@ class CONTENT_EXPORT BrowserAccessibilityManagerWin
parent_iaccessible_ = parent_iaccessible;
}
- void SetAccessibleHWND(LegacyRenderWidgetHostHWND* accessible_hwnd);
-
// Calls NotifyWinEvent if the parent window's IAccessible pointer is known.
void MaybeCallNotifyWinEvent(DWORD event, LONG child_id);
diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc
index 60728e0..e98ae71 100644
--- a/content/browser/accessibility/browser_accessibility_win.cc
+++ b/content/browser/accessibility/browser_accessibility_win.cc
@@ -739,9 +739,6 @@ STDMETHODIMP BrowserAccessibilityWin::get_windowHandle(HWND* window_handle) {
return E_INVALIDARG;
*window_handle = manager()->ToBrowserAccessibilityManagerWin()->parent_hwnd();
- if (!*window_handle)
- return E_FAIL;
-
return S_OK;
}
@@ -995,8 +992,6 @@ STDMETHODIMP BrowserAccessibilityWin::get_imagePosition(
if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) {
HWND parent_hwnd =
manager()->ToBrowserAccessibilityManagerWin()->parent_hwnd();
- if (!parent_hwnd)
- return E_FAIL;
POINT top_left = {0, 0};
::ClientToScreen(parent_hwnd, &top_left);
*x = GetLocation().x() + top_left.x;
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index ad3e95f..44d57f5 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -999,11 +999,6 @@ void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) {
if (!legacy_render_widget_host_HWND_) {
legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create(
reinterpret_cast<HWND>(GetNativeViewId()));
- BrowserAccessibilityManagerWin* manager =
- static_cast<BrowserAccessibilityManagerWin*>(
- GetBrowserAccessibilityManager());
- if (manager)
- manager->SetAccessibleHWND(legacy_render_widget_host_HWND_.get());
}
if (legacy_render_widget_host_HWND_) {
legacy_render_widget_host_HWND_->SetBounds(
@@ -1231,23 +1226,33 @@ InputEventAckState RenderWidgetHostViewAura::FilterInputEvent(
}
void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() {
+ if (GetBrowserAccessibilityManager())
+ return;
+
+ BrowserAccessibilityManager* manager = NULL;
#if defined(OS_WIN)
- if (!GetBrowserAccessibilityManager()) {
- gfx::NativeViewAccessible accessible_parent =
- host_->GetParentNativeViewAccessible();
- LegacyRenderWidgetHostHWND* parent_hwnd =
- legacy_render_widget_host_HWND_.get();
- SetBrowserAccessibilityManager(new BrowserAccessibilityManagerWin(
+ aura::WindowTreeHost* host = window_->GetHost();
+ if (!host)
+ return;
+ HWND hwnd = host->GetAcceleratedWidget();
+
+ // The accessible_parent may be NULL at this point. The WebContents will pass
+ // it down to this instance (by way of the RenderViewHost and
+ // RenderWidgetHost) when it is known. This instance will then set it on its
+ // BrowserAccessibilityManager.
+ gfx::NativeViewAccessible accessible_parent =
+ host_->GetParentNativeViewAccessible();
+
+ if (legacy_render_widget_host_HWND_) {
+ manager = new BrowserAccessibilityManagerWin(
legacy_render_widget_host_HWND_.get(), accessible_parent,
- BrowserAccessibilityManagerWin::GetEmptyDocument(), host_));
+ BrowserAccessibilityManagerWin::GetEmptyDocument(), host_);
}
#else
- if (!GetBrowserAccessibilityManager()) {
- SetBrowserAccessibilityManager(
- BrowserAccessibilityManager::Create(
- BrowserAccessibilityManager::GetEmptyDocument(), host_));
- }
+ manager = BrowserAccessibilityManager::Create(
+ BrowserAccessibilityManager::GetEmptyDocument(), host_);
#endif
+ SetBrowserAccessibilityManager(manager);
}
gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() {