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

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: update 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
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 // TODO(nasko): Temporarily friend RenderFrameImpl, so we don't duplicate 540 // TODO(nasko): Temporarily friend RenderFrameImpl, so we don't duplicate
543 // utility functions needed in both classes, while we move frame specific 541 // utility functions needed in both classes, while we move frame specific
544 // code away from this class. 542 // code away from this class.
545 friend class RenderFrameImpl; 543 friend class RenderFrameImpl;
546 544
547 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI); 545 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI);
548 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 546 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
549 DidFailProvisionalLoadWithErrorForError); 547 DidFailProvisionalLoadWithErrorForError);
550 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 548 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
551 DidFailProvisionalLoadWithErrorForCancellation); 549 DidFailProvisionalLoadWithErrorForCancellation);
552 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
553 DontIgnoreBackAfterNavEntryLimit);
554 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition); 550 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition);
555 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters); 551 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters);
556 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad); 552 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad);
557 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState); 553 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState);
558 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent); 554 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent);
559 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeTypeChanged); 555 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeTypeChanged);
560 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged); 556 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged);
561 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection); 557 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection);
562 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences); 558 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences);
563 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 559 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
564 SetEditableSelectionAndComposition); 560 SetEditableSelectionAndComposition);
565 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored); 561 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored);
562 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
563 DontIgnoreBackAfterNavEntryLimit);
566 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL); 564 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL);
567 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 565 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
568 GetCompositionCharacterBoundsTest); 566 GetCompositionCharacterBoundsTest);
569 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavigationHttpPost); 567 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavigationHttpPost);
570 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 568 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
571 DecideNavigationPolicyHandlesAllTopLevel); 569 DecideNavigationPolicyHandlesAllTopLevel);
572 #if defined(OS_MACOSX) 570 #if defined(OS_MACOSX)
573 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp); 571 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp);
574 #endif 572 #endif
575 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune); 573 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndOffset);
576 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit); 574 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit);
577 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, NavigateFrame); 575 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, NavigateFrame);
578 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, BasicRenderFrame); 576 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, BasicRenderFrame);
579 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, TextInputTypeWithPepper); 577 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, TextInputTypeWithPepper);
580 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 578 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
581 MessageOrderInDidChangeSelection); 579 MessageOrderInDidChangeSelection);
582 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendCandidateWindowEvents); 580 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendCandidateWindowEvents);
583 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, Suppresses); 581 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, Suppresses);
584 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, DoesNotSuppress); 582 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, DoesNotSuppress);
585 583
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 const blink::WebMediaPlayerAction& action); 674 const blink::WebMediaPlayerAction& action);
677 void OnPluginActionAt(const gfx::Point& location, 675 void OnPluginActionAt(const gfx::Point& location,
678 const blink::WebPluginAction& action); 676 const blink::WebPluginAction& action);
679 void OnMoveOrResizeStarted(); 677 void OnMoveOrResizeStarted();
680 void OnPostMessageEvent(const ViewMsg_PostMessage_Params& params); 678 void OnPostMessageEvent(const ViewMsg_PostMessage_Params& params);
681 void OnReleaseDisambiguationPopupBitmap(const cc::SharedBitmapId& id); 679 void OnReleaseDisambiguationPopupBitmap(const cc::SharedBitmapId& id);
682 void OnResetPageEncodingToDefault(); 680 void OnResetPageEncodingToDefault();
683 void OnSetActive(bool active); 681 void OnSetActive(bool active);
684 void OnSetBackgroundOpaque(bool opaque); 682 void OnSetBackgroundOpaque(bool opaque);
685 void OnExitFullscreen(); 683 void OnExitFullscreen();
686 void OnSetHistoryLengthAndPrune(int history_length, int32 minimum_page_id); 684 void OnSetHistoryOffsetAndLength(int history_offset, int history_length);
687 void OnSetInitialFocus(bool reverse); 685 void OnSetInitialFocus(bool reverse);
688 void OnSetPageEncoding(const std::string& encoding_name); 686 void OnSetPageEncoding(const std::string& encoding_name);
689 void OnSetRendererPrefs(const RendererPreferences& renderer_prefs); 687 void OnSetRendererPrefs(const RendererPreferences& renderer_prefs);
690 void OnSetWebUIProperty(const std::string& name, const std::string& value); 688 void OnSetWebUIProperty(const std::string& name, const std::string& value);
691 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level); 689 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level);
692 void OnSetZoomLevelForView(bool uses_temporary_zoom_level, double level); 690 void OnSetZoomLevelForView(bool uses_temporary_zoom_level, double level);
693 void OnStopFinding(StopFindAction action); 691 void OnStopFinding(StopFindAction action);
694 void OnSuppressDialogsUntilSwapOut(); 692 void OnSuppressDialogsUntilSwapOut();
695 void OnThemeChanged(); 693 void OnThemeChanged();
696 void OnUpdateTargetURLAck(); 694 void OnUpdateTargetURLAck();
(...skipping 26 matching lines...) Expand all
723 // and put it in the same position in the .cc file. 721 // and put it in the same position in the .cc file.
724 722
725 // Misc private functions ---------------------------------------------------- 723 // Misc private functions ----------------------------------------------------
726 // Check whether the preferred size has changed. 724 // Check whether the preferred size has changed.
727 void CheckPreferredSize(); 725 void CheckPreferredSize();
728 726
729 // 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.
730 // Returns NULL if there is no such WebPlugin. 728 // Returns NULL if there is no such WebPlugin.
731 blink::WebPlugin* GetWebPluginForFind(); 729 blink::WebPlugin* GetWebPluginForFind();
732 730
733 // Returns true if the |params| navigation is to an entry that has been
734 // cropped due to a recent navigation the browser did not know about.
735 bool IsBackForwardToStaleEntry(const PageState& state,
736 int pending_history_list_offset,
737 int32 page_id,
738 bool is_reload);
739 731
740 // If we initiated a navigation, this function will populate |document_state| 732 // If we initiated a navigation, this function will populate |document_state|
741 // with the navigation information saved in OnNavigate(). 733 // with the navigation information saved in OnNavigate().
742 void PopulateDocumentStateFromPending(DocumentState* document_state); 734 void PopulateDocumentStateFromPending(DocumentState* document_state);
743 735
744 // Returns a new NavigationState populated with the navigation information 736 // Returns a new NavigationState populated with the navigation information
745 // saved in OnNavigate(). 737 // saved in OnNavigate().
746 NavigationState* CreateNavigationStateFromPending(); 738 NavigationState* CreateNavigationStateFromPending();
747 739
748 // Processes the command-line flags --enable-viewport, 740 // Processes the command-line flags --enable-viewport,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 // navigations, the history may have some entries that were committed in other 887 // navigations, the history may have some entries that were committed in other
896 // processes. We won't know about them until the next navigation in this 888 // processes. We won't know about them until the next navigation in this
897 // process. 889 // process.
898 int history_list_length_; 890 int history_list_length_;
899 891
900 // Counter to track how many frames have sent start notifications but not stop 892 // Counter to track how many frames have sent start notifications but not stop
901 // notifications. TODO(avi): Remove this once DidStartLoading/DidStopLoading 893 // notifications. TODO(avi): Remove this once DidStartLoading/DidStopLoading
902 // are gone. 894 // are gone.
903 int frames_in_progress_; 895 int frames_in_progress_;
904 896
905 // The list of page IDs for each history item this RenderView knows about.
906 // Some entries may be -1 if they were rendered by other processes or were
907 // restored from a previous session. This lets us detect attempts to
908 // navigate to stale entries that have been cropped from our history.
909 std::vector<int32> history_page_ids_;
910
911 // UI state ------------------------------------------------------------------ 897 // UI state ------------------------------------------------------------------
912 898
913 // The state of our target_url transmissions. When we receive a request to 899 // The state of our target_url transmissions. When we receive a request to
914 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK 900 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK
915 // comes back - if a new request comes in before the ACK, we store the new 901 // comes back - if a new request comes in before the ACK, we store the new
916 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an 902 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an
917 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and 903 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and
918 // revert to TARGET_INFLIGHT. 904 // revert to TARGET_INFLIGHT.
919 // 905 //
920 // We don't need a queue of URLs to send, as only the latest is useful. 906 // 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
1087 // use the Observer interface to filter IPC messages and receive frame change 1073 // use the Observer interface to filter IPC messages and receive frame change
1088 // notifications. 1074 // notifications.
1089 // --------------------------------------------------------------------------- 1075 // ---------------------------------------------------------------------------
1090 1076
1091 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); 1077 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
1092 }; 1078 };
1093 1079
1094 } // namespace content 1080 } // namespace content
1095 1081
1096 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ 1082 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698