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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.h

Issue 629413002: Revert of Reset accessibility if it gets out of sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 STATE_PENDING_SWAP_OUT, 81 STATE_PENDING_SWAP_OUT,
82 // The RFH is swapped out and stored inside a RenderFrameProxyHost, being 82 // The RFH is swapped out and stored inside a RenderFrameProxyHost, being
83 // used as a placeholder to allow cross-process communication. Only main 83 // used as a placeholder to allow cross-process communication. Only main
84 // frames can enter this state. 84 // frames can enter this state.
85 STATE_SWAPPED_OUT, 85 STATE_SWAPPED_OUT,
86 }; 86 };
87 // Helper function to determine whether the RFH state should contribute to the 87 // Helper function to determine whether the RFH state should contribute to the
88 // number of active frames of a SiteInstance or not. 88 // number of active frames of a SiteInstance or not.
89 static bool IsRFHStateActive(RenderFrameHostImplState rfh_state); 89 static bool IsRFHStateActive(RenderFrameHostImplState rfh_state);
90 90
91 // An accessibility reset is only allowed to prevent very rare corner cases
92 // or race conditions where the browser and renderer get out of sync. If
93 // this happens more than this many times, kill the renderer.
94 static const int kMaxAccessibilityResets = 5;
95
96 static RenderFrameHostImpl* FromID(int process_id, int routing_id); 91 static RenderFrameHostImpl* FromID(int process_id, int routing_id);
97 92
98 virtual ~RenderFrameHostImpl(); 93 virtual ~RenderFrameHostImpl();
99 94
100 // RenderFrameHost 95 // RenderFrameHost
101 virtual int GetRoutingID() OVERRIDE; 96 virtual int GetRoutingID() OVERRIDE;
102 virtual SiteInstanceImpl* GetSiteInstance() OVERRIDE; 97 virtual SiteInstanceImpl* GetSiteInstance() OVERRIDE;
103 virtual RenderProcessHost* GetProcess() OVERRIDE; 98 virtual RenderProcessHost* GetProcess() OVERRIDE;
104 virtual RenderFrameHost* GetParent() OVERRIDE; 99 virtual RenderFrameHost* GetParent() OVERRIDE;
105 virtual const std::string& GetFrameName() OVERRIDE; 100 virtual const std::string& GetFrameName() OVERRIDE;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // Access the BrowserAccessibilityManager if it already exists. 325 // Access the BrowserAccessibilityManager if it already exists.
331 BrowserAccessibilityManager* browser_accessibility_manager() const { 326 BrowserAccessibilityManager* browser_accessibility_manager() const {
332 return browser_accessibility_manager_.get(); 327 return browser_accessibility_manager_.get();
333 } 328 }
334 329
335 // If accessibility is enabled, get the BrowserAccessibilityManager for 330 // If accessibility is enabled, get the BrowserAccessibilityManager for
336 // this frame, or create one if it doesn't exist yet, otherwise return 331 // this frame, or create one if it doesn't exist yet, otherwise return
337 // NULL. 332 // NULL.
338 BrowserAccessibilityManager* GetOrCreateBrowserAccessibilityManager(); 333 BrowserAccessibilityManager* GetOrCreateBrowserAccessibilityManager();
339 334
340 void set_disallow_browser_accessibility_manager_for_testing(bool flag) {
341 disallow_browser_accessibility_manager_for_testing_ = flag;
342 }
343
344 #if defined(OS_WIN) 335 #if defined(OS_WIN)
345 void SetParentNativeViewAccessible( 336 void SetParentNativeViewAccessible(
346 gfx::NativeViewAccessible accessible_parent); 337 gfx::NativeViewAccessible accessible_parent);
347 gfx::NativeViewAccessible GetParentNativeViewAccessible() const; 338 gfx::NativeViewAccessible GetParentNativeViewAccessible() const;
348 #elif defined(OS_MACOSX) 339 #elif defined(OS_MACOSX)
349 // Select popup menu related methods (for external popup menus). 340 // Select popup menu related methods (for external popup menus).
350 void DidSelectPopupMenuItem(int selected_index); 341 void DidSelectPopupMenuItem(int selected_index);
351 void DidCancelPopupMenu(); 342 void DidCancelPopupMenu();
352 #elif defined(OS_ANDROID) 343 #elif defined(OS_ANDROID)
353 void DidSelectPopupMenuItems(const std::vector<int>& selected_indices); 344 void DidSelectPopupMenuItems(const std::vector<int>& selected_indices);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 void OnDidAccessInitialDocument(); 416 void OnDidAccessInitialDocument();
426 void OnDidDisownOpener(); 417 void OnDidDisownOpener();
427 void OnDidAssignPageId(int32 page_id); 418 void OnDidAssignPageId(int32 page_id);
428 void OnUpdateTitle(int32 page_id, 419 void OnUpdateTitle(int32 page_id,
429 const base::string16& title, 420 const base::string16& title,
430 blink::WebTextDirection title_direction); 421 blink::WebTextDirection title_direction);
431 void OnUpdateEncoding(const std::string& encoding); 422 void OnUpdateEncoding(const std::string& encoding);
432 void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params, 423 void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params,
433 const CommonNavigationParams& common_params); 424 const CommonNavigationParams& common_params);
434 void OnAccessibilityEvents( 425 void OnAccessibilityEvents(
435 const std::vector<AccessibilityHostMsg_EventParams>& params, 426 const std::vector<AccessibilityHostMsg_EventParams>& params);
436 int reset_token);
437 void OnAccessibilityLocationChanges( 427 void OnAccessibilityLocationChanges(
438 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params); 428 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params);
439 429
440 #if defined(OS_MACOSX) || defined(OS_ANDROID) 430 #if defined(OS_MACOSX) || defined(OS_ANDROID)
441 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); 431 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params);
442 void OnHidePopup(); 432 void OnHidePopup();
443 #endif 433 #endif
444 434
445 // Updates the state of this RenderFrameHost and clears any waiting state 435 // Updates the state of this RenderFrameHost and clears any waiting state
446 // that is no longer relevant. 436 // that is no longer relevant.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 // the case of a cross-site transition ( = true). 540 // the case of a cross-site transition ( = true).
551 bool unload_ack_is_for_cross_site_transition_; 541 bool unload_ack_is_for_cross_site_transition_;
552 542
553 // Used to swap out or shut down this RFH when the unload event is taking too 543 // Used to swap out or shut down this RFH when the unload event is taking too
554 // long to execute, depending on the number of active frames in the 544 // long to execute, depending on the number of active frames in the
555 // SiteInstance. 545 // SiteInstance.
556 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; 546 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_;
557 547
558 ServiceRegistryImpl service_registry_; 548 ServiceRegistryImpl service_registry_;
559 549
560 // The object managing the accessibility tree for this frame.
561 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_; 550 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_;
562 551
563 // This is nonzero if we sent an accessibility reset to the renderer and
564 // we're waiting for an IPC containing this reset token (sequentially
565 // assigned) and a complete replacement accessibility tree.
566 int accessibility_reset_token_;
567
568 // A count of the number of times we needed to reset accessibility, so
569 // we don't keep trying to reset forever.
570 int accessibility_reset_count_;
571
572 // Callback when an event is received, for testing. 552 // Callback when an event is received, for testing.
573 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_; 553 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_;
574 // The most recently received accessibility tree - for testing only. 554 // The most recently received accessibility tree - for testing only.
575 scoped_ptr<ui::AXTree> ax_tree_for_testing_; 555 scoped_ptr<ui::AXTree> ax_tree_for_testing_;
576 // Flag to not create a BrowserAccessibilityManager, for testing.
577 bool disallow_browser_accessibility_manager_for_testing_;
578 556
579 // NOTE: This must be the last member. 557 // NOTE: This must be the last member.
580 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 558 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
581 559
582 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 560 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
583 }; 561 };
584 562
585 } // namespace content 563 } // namespace content
586 564
587 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 565 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698