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

Side by Side Diff: content/renderer/render_view_impl.h

Issue 743803002: Avoid stale navigation requests without excessive page id knowledge in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more saving Created 6 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_RENDERER_RENDER_VIEW_IMPL_H_ 5 #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ 6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 static RenderViewImpl* FromWebView(blink::WebView* webview); 177 static RenderViewImpl* FromWebView(blink::WebView* webview);
178 178
179 // Returns the RenderViewImpl for the given routing ID. 179 // Returns the RenderViewImpl for the given routing ID.
180 static RenderViewImpl* FromRoutingID(int routing_id); 180 static RenderViewImpl* FromRoutingID(int routing_id);
181 181
182 static size_t GetRenderViewCount(); 182 static size_t GetRenderViewCount();
183 183
184 // May return NULL when the view is closing. 184 // May return NULL when the view is closing.
185 blink::WebView* webview() const; 185 blink::WebView* webview() const;
186 186
187 int history_list_offset() const { return history_list_offset_; }
188
189 const WebPreferences& webkit_preferences() const { 187 const WebPreferences& webkit_preferences() const {
190 return webkit_preferences_; 188 return webkit_preferences_;
191 } 189 }
192 190
193 const RendererPreferences& renderer_preferences() const { 191 const RendererPreferences& renderer_preferences() const {
194 return renderer_preferences_; 192 return renderer_preferences_;
195 } 193 }
196 194
197 void set_send_content_state_immediately(bool value) { 195 void set_send_content_state_immediately(bool value) {
198 send_content_state_immediately_ = value; 196 send_content_state_immediately_ = value;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 // TODO(nasko): Temporarily friend RenderFrameImpl, so we don't duplicate 542 // TODO(nasko): Temporarily friend RenderFrameImpl, so we don't duplicate
545 // utility functions needed in both classes, while we move frame specific 543 // utility functions needed in both classes, while we move frame specific
546 // code away from this class. 544 // code away from this class.
547 friend class RenderFrameImpl; 545 friend class RenderFrameImpl;
548 546
549 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI); 547 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI);
550 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 548 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
551 DidFailProvisionalLoadWithErrorForError); 549 DidFailProvisionalLoadWithErrorForError);
552 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 550 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
553 DidFailProvisionalLoadWithErrorForCancellation); 551 DidFailProvisionalLoadWithErrorForCancellation);
554 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
555 DontIgnoreBackAfterNavEntryLimit);
556 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition); 552 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition);
557 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters); 553 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters);
558 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad); 554 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad);
559 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState); 555 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState);
560 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent); 556 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent);
561 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeTypeChanged); 557 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeTypeChanged);
562 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged); 558 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged);
563 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection); 559 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection);
564 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences); 560 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences);
565 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 561 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
566 SetEditableSelectionAndComposition); 562 SetEditableSelectionAndComposition);
567 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored); 563 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored);
568 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL); 564 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL);
569 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 565 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
570 GetCompositionCharacterBoundsTest); 566 GetCompositionCharacterBoundsTest);
571 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavigationHttpPost); 567 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavigationHttpPost);
572 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 568 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
573 DecideNavigationPolicyHandlesAllTopLevel); 569 DecideNavigationPolicyHandlesAllTopLevel);
574 #if defined(OS_MACOSX) 570 #if defined(OS_MACOSX)
575 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp); 571 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp);
576 #endif 572 #endif
577 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune); 573 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndOffset);
578 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit); 574 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit);
579 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, NavigateFrame); 575 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, NavigateFrame);
580 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, BasicRenderFrame); 576 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, BasicRenderFrame);
581 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, TextInputTypeWithPepper); 577 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, TextInputTypeWithPepper);
582 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 578 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
583 MessageOrderInDidChangeSelection); 579 MessageOrderInDidChangeSelection);
584 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendCandidateWindowEvents); 580 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendCandidateWindowEvents);
585 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, Suppresses); 581 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, Suppresses);
586 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, DoesNotSuppress); 582 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, DoesNotSuppress);
587 583
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 const blink::WebMediaPlayerAction& action); 674 const blink::WebMediaPlayerAction& action);
679 void OnPluginActionAt(const gfx::Point& location, 675 void OnPluginActionAt(const gfx::Point& location,
680 const blink::WebPluginAction& action); 676 const blink::WebPluginAction& action);
681 void OnMoveOrResizeStarted(); 677 void OnMoveOrResizeStarted();
682 void OnPostMessageEvent(const ViewMsg_PostMessage_Params& params); 678 void OnPostMessageEvent(const ViewMsg_PostMessage_Params& params);
683 void OnReleaseDisambiguationPopupBitmap(const cc::SharedBitmapId& id); 679 void OnReleaseDisambiguationPopupBitmap(const cc::SharedBitmapId& id);
684 void OnResetPageEncodingToDefault(); 680 void OnResetPageEncodingToDefault();
685 void OnSetActive(bool active); 681 void OnSetActive(bool active);
686 void OnSetBackgroundOpaque(bool opaque); 682 void OnSetBackgroundOpaque(bool opaque);
687 void OnExitFullscreen(); 683 void OnExitFullscreen();
688 void OnSetHistoryLengthAndPrune(int history_length, int32 minimum_page_id); 684 void OnSetHistoryOffsetAndLength(int history_offset, int history_length);
689 void OnSetInitialFocus(bool reverse); 685 void OnSetInitialFocus(bool reverse);
690 void OnSetPageEncoding(const std::string& encoding_name); 686 void OnSetPageEncoding(const std::string& encoding_name);
691 void OnSetRendererPrefs(const RendererPreferences& renderer_prefs); 687 void OnSetRendererPrefs(const RendererPreferences& renderer_prefs);
692 void OnSetWebUIProperty(const std::string& name, const std::string& value); 688 void OnSetWebUIProperty(const std::string& name, const std::string& value);
693 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level); 689 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level);
694 void OnSetZoomLevelForView(bool uses_temporary_zoom_level, double level); 690 void OnSetZoomLevelForView(bool uses_temporary_zoom_level, double level);
695 void OnStopFinding(StopFindAction action); 691 void OnStopFinding(StopFindAction action);
696 void OnSuppressDialogsUntilSwapOut(); 692 void OnSuppressDialogsUntilSwapOut();
697 void OnThemeChanged(); 693 void OnThemeChanged();
698 void OnUpdateTargetURLAck(); 694 void OnUpdateTargetURLAck();
(...skipping 26 matching lines...) Expand all
725 // and put it in the same position in the .cc file. 721 // and put it in the same position in the .cc file.
726 722
727 // Misc private functions ---------------------------------------------------- 723 // Misc private functions ----------------------------------------------------
728 // Check whether the preferred size has changed. 724 // Check whether the preferred size has changed.
729 void CheckPreferredSize(); 725 void CheckPreferredSize();
730 726
731 // Called to get the WebPlugin to handle find requests in the document. 727 // Called to get the WebPlugin to handle find requests in the document.
732 // Returns NULL if there is no such WebPlugin. 728 // Returns NULL if there is no such WebPlugin.
733 blink::WebPlugin* GetWebPluginForFind(); 729 blink::WebPlugin* GetWebPluginForFind();
734 730
735 // Returns true if the |params| navigation is to an entry that has been
736 // cropped due to a recent navigation the browser did not know about.
737 bool IsBackForwardToStaleEntry(const PageState& state,
738 int pending_history_list_offset,
739 int32 page_id,
740 bool is_reload);
741 731
742 // If we initiated a navigation, this function will populate |document_state| 732 // If we initiated a navigation, this function will populate |document_state|
743 // with the navigation information saved in OnNavigate(). 733 // with the navigation information saved in OnNavigate().
744 void PopulateDocumentStateFromPending(DocumentState* document_state); 734 void PopulateDocumentStateFromPending(DocumentState* document_state);
745 735
746 // Returns a new NavigationState populated with the navigation information 736 // Returns a new NavigationState populated with the navigation information
747 // saved in OnNavigate(). 737 // saved in OnNavigate().
748 NavigationState* CreateNavigationStateFromPending(); 738 NavigationState* CreateNavigationStateFromPending();
749 739
750 // Processes the command-line flags --enable-viewport, 740 // Processes the command-line flags --enable-viewport,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 // goes back. 875 // goes back.
886 int32 last_page_id_sent_to_browser_; 876 int32 last_page_id_sent_to_browser_;
887 877
888 // The next available page ID to use for this RenderView. These IDs are 878 // The next available page ID to use for this RenderView. These IDs are
889 // specific to a given RenderView and the frames within it. 879 // specific to a given RenderView and the frames within it.
890 int32 next_page_id_; 880 int32 next_page_id_;
891 881
892 // The offset of the current item in the history list. 882 // The offset of the current item in the history list.
893 int history_list_offset_; 883 int history_list_offset_;
894 884
895 // The RenderView's current impression of the history length. This includes 885 // The RenderView's current impression of the history length.
896 // any items that have committed in this process, but because of cross-process
897 // navigations, the history may have some entries that were committed in other
898 // processes. We won't know about them until the next navigation in this
899 // process.
Charlie Reis 2014/12/03 23:48:07 Any reason to delete this? Sounds like it's still
Avi (use Gerrit) 2014/12/04 21:15:16 Done.
900 int history_list_length_; 886 int history_list_length_;
901 887
902 // Counter to track how many frames have sent start notifications but not stop 888 // Counter to track how many frames have sent start notifications but not stop
903 // notifications. TODO(avi): Remove this once DidStartLoading/DidStopLoading 889 // notifications. TODO(avi): Remove this once DidStartLoading/DidStopLoading
904 // are gone. 890 // are gone.
905 int frames_in_progress_; 891 int frames_in_progress_;
906 892
907 // The list of page IDs for each history item this RenderView knows about.
908 // Some entries may be -1 if they were rendered by other processes or were
909 // restored from a previous session. This lets us detect attempts to
910 // navigate to stale entries that have been cropped from our history.
911 std::vector<int32> history_page_ids_;
Charlie Reis 2014/12/03 23:48:07 Woo hoo!
Avi (use Gerrit) 2014/12/04 21:15:16 Acknowledged.
912
913 // UI state ------------------------------------------------------------------ 893 // UI state ------------------------------------------------------------------
914 894
915 // The state of our target_url transmissions. When we receive a request to 895 // The state of our target_url transmissions. When we receive a request to
916 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK 896 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK
917 // comes back - if a new request comes in before the ACK, we store the new 897 // comes back - if a new request comes in before the ACK, we store the new
918 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an 898 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an
919 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and 899 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and
920 // revert to TARGET_INFLIGHT. 900 // revert to TARGET_INFLIGHT.
921 // 901 //
922 // We don't need a queue of URLs to send, as only the latest is useful. 902 // We don't need a queue of URLs to send, as only the latest is useful.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 // use the Observer interface to filter IPC messages and receive frame change 1069 // use the Observer interface to filter IPC messages and receive frame change
1090 // notifications. 1070 // notifications.
1091 // --------------------------------------------------------------------------- 1071 // ---------------------------------------------------------------------------
1092 1072
1093 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); 1073 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
1094 }; 1074 };
1095 1075
1096 } // namespace content 1076 } // namespace content
1097 1077
1098 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ 1078 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698