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

Issue 14985014: Introduce content::PageState (Closed)

Created:
7 years, 7 months ago by darin (slow to review)
Modified:
7 years, 7 months ago
Reviewers:
Tom Sepez, brettw
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam, tfarina
Visibility:
Public.

Description

Introduce content::PageState. This is a concrete class wrapping a string that contains the data of a serialized WebKit::WebHistoryItem class. Previously, we've just passed around these as strings, giving them names like "state", "content_state" or "history_state". It has been hard to identify all of the places in the code where these strings get passed around. A concrete class should make usage more apparent. Plus, instead of manipulating the strings using methods from webkit/glue/glue_serialize.h, we can just declare methods on the PageState class. This makes the code much cleaner. This first pass just implements PageState in terms of glue_serialize. It also adds content/public/renderer/history_item_serialization.h as the home for PageState to WebKit::WebHistoryItem conversion, which should ideally only be usable from the renderer process. (This bit is a step toward resolving bug 237243.) page_state.h declares operator==() to support DCHECK_EQ, which seems consistent with the idea of PageState being a replacement for std::string. I didn't want to litter tests with calls to PageState::ToEncodedData(). That would get cumbersome. BUG=240426 R=brettw@chromium.org, tsepez@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=202188

Patch Set 1 #

Patch Set 2 : Should be functional! #

Patch Set 3 : Fix compilation issues. #

Total comments: 2

Patch Set 4 : Fix test failures. #

Patch Set 5 : Fix IOS build issue. #

Patch Set 6 : Rebase #

Patch Set 7 : Fix IOS build. #

Patch Set 8 : Rebase #

Patch Set 9 : Android and IOS fixes. #

Patch Set 10 : Fix Android and IOS build. #

Patch Set 11 : rebase #

Patch Set 12 : fix android build #

Patch Set 13 : Add comments to the top of page_state.h #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+541 lines, -980 lines) Patch
M android_webview/native/state_serializer.cc View 1 2 3 4 5 6 7 8 3 chunks +4 lines, -2 lines 0 comments Download
M android_webview/native/state_serializer_unittests.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +5 lines, -3 lines 0 comments Download
M chrome/browser/sessions/session_restore.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +3 lines, -4 lines 0 comments Download
M chrome/browser/sessions/session_service_unittest.cc View 1 2 5 chunks +18 lines, -31 lines 0 comments Download
M chrome/browser/sessions/session_types_unittest.cc View 1 2 3 chunks +4 lines, -3 lines 0 comments Download
M chrome/browser/tab_contents/render_view_context_menu.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/browser.h View 1 2 3 4 5 6 7 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/ui/browser.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/browser_commands.h View 1 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/ui/browser_commands.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +3 lines, -5 lines 1 comment Download
M components/sessions/serialized_navigation_entry.h View 1 3 chunks +3 lines, -2 lines 0 comments Download
M components/sessions/serialized_navigation_entry.cc View 1 2 7 chunks +14 lines, -13 lines 0 comments Download
M components/sessions/serialized_navigation_entry_test_helper.h View 1 2 chunks +3 lines, -2 lines 0 comments Download
M components/sessions/serialized_navigation_entry_test_helper.cc View 1 2 2 chunks +6 lines, -5 lines 0 comments Download
M components/sessions/serialized_navigation_entry_unittest.cc View 1 2 8 chunks +9 lines, -8 lines 0 comments Download
M content/browser/renderer_host/render_view_host_delegate.h View 2 chunks +2 lines, -1 line 0 comments Download
M content/browser/renderer_host/render_view_host_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +3 lines, -2 lines 0 comments Download
M content/browser/renderer_host/render_view_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +7 lines, -9 lines 0 comments Download
M content/browser/renderer_host/test_render_view_host.cc View 1 2 4 chunks +12 lines, -27 lines 0 comments Download
M content/browser/web_contents/navigation_controller_impl.cc View 1 2 4 chunks +6 lines, -9 lines 0 comments Download
M content/browser/web_contents/navigation_controller_impl_unittest.cc View 1 2 20 chunks +19 lines, -19 lines 0 comments Download
M content/browser/web_contents/navigation_entry_impl.h View 3 chunks +4 lines, -3 lines 0 comments Download
M content/browser/web_contents/navigation_entry_impl.cc View 1 chunk +4 lines, -4 lines 0 comments Download
M content/browser/web_contents/navigation_entry_impl_unittest.cc View 1 2 1 chunk +4 lines, -4 lines 0 comments Download
M content/browser/web_contents/render_view_host_manager_unittest.cc View 1 2 3 4 5 2 chunks +1 line, -2 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.h View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 5 6 7 4 chunks +6 lines, -6 lines 0 comments Download
M content/browser/web_contents/web_contents_impl_unittest.cc View 1 2 3 4 5 6 7 4 chunks +11 lines, -12 lines 0 comments Download
M content/common/view_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +5 lines, -4 lines 0 comments Download
M content/content_common.gypi View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M content/content_renderer.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -0 lines 0 comments Download
M content/public/browser/navigation_entry.h View 3 chunks +4 lines, -2 lines 0 comments Download
M content/public/browser/web_contents.h View 1 2 3 4 5 6 7 2 chunks +2 lines, -1 line 0 comments Download
M content/public/browser/web_contents_delegate.h View 1 2 3 4 5 6 7 2 chunks +2 lines, -1 line 0 comments Download
M content/public/browser/web_contents_delegate.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M content/public/common/common_param_traits.h View 1 2 3 4 5 2 chunks +9 lines, -0 lines 0 comments Download
M content/public/common/common_param_traits.cc View 1 2 2 chunks +22 lines, -0 lines 0 comments Download
M content/public/common/context_menu_params.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -3 lines 0 comments Download
A content/public/common/page_state.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +66 lines, -0 lines 3 comments Download
A content/public/common/page_state.cc View 1 2 3 1 chunk +87 lines, -0 lines 1 comment Download
A content/public/common/page_state_ios.cc View 1 2 3 4 5 6 7 8 9 1 chunk +70 lines, -0 lines 0 comments Download
A content/public/renderer/history_item_serialization.h View 1 1 chunk +26 lines, -0 lines 0 comments Download
A content/public/renderer/history_item_serialization.cc View 1 2 1 chunk +21 lines, -0 lines 0 comments Download
M content/public/test/render_view_fake_resources_test.cc View 1 3 chunks +2 lines, -2 lines 0 comments Download
M content/public/test/render_view_test.cc View 1 3 chunks +2 lines, -2 lines 0 comments Download
M content/renderer/context_menu_params_builder.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -5 lines 0 comments Download
M content/renderer/render_view_browsertest.cc View 1 2 3 4 5 20 chunks +21 lines, -21 lines 0 comments Download
M content/renderer/render_view_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +11 lines, -12 lines 1 comment Download
M content/shell/common/shell_messages.h View 1 2 chunks +2 lines, -1 line 0 comments Download
M content/shell/renderer/webkit_test_runner.h View 1 2 3 4 5 6 7 3 chunks +3 lines, -2 lines 0 comments Download
M content/shell/renderer/webkit_test_runner.cc View 1 2 3 4 5 6 7 4 chunks +3 lines, -3 lines 0 comments Download
M content/shell/webkit_test_controller.cc View 1 2 3 chunks +6 lines, -7 lines 0 comments Download
M content/test/test_web_contents.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
D webkit/glue/glue_serialize.h View 1 chunk +0 lines, -57 lines 0 comments Download
D webkit/glue/glue_serialize.cc View 1 1 chunk +0 lines, -668 lines 0 comments Download
A + webkit/glue/glue_serialize_deprecated.h View 0 chunks +-1 lines, --1 lines 0 comments Download
A + webkit/glue/glue_serialize_deprecated.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M webkit/glue/glue_serialize_unittest.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M webkit/glue/webkit_glue.gypi View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
darin (slow to review)
Brett, I'm just looking for some initial design feedback from you. You don't need to ...
7 years, 7 months ago (2013-05-16 20:38:35 UTC) #1
tfarina
https://codereview.chromium.org/14985014/diff/7001/content/public/common/page_state.h File content/public/common/page_state.h (right): https://codereview.chromium.org/14985014/diff/7001/content/public/common/page_state.h#newcode46 content/public/common/page_state.h:46: }; DISALLOW_COPY_AND_ASSIGN?
7 years, 7 months ago (2013-05-16 22:16:48 UTC) #2
darin (slow to review)
On 2013/05/16 22:16:48, tfarina wrote: > https://codereview.chromium.org/14985014/diff/7001/content/public/common/page_state.h > File content/public/common/page_state.h (right): > > https://codereview.chromium.org/14985014/diff/7001/content/public/common/page_state.h#newcode46 > ...
7 years, 7 months ago (2013-05-17 00:26:16 UTC) #3
brettw
PageState seems fine. https://codereview.chromium.org/14985014/diff/7001/content/public/renderer/history_item_serialization.h File content/public/renderer/history_item_serialization.h (right): https://codereview.chromium.org/14985014/diff/7001/content/public/renderer/history_item_serialization.h#newcode19 content/public/renderer/history_item_serialization.h:19: CONTENT_EXPORT PageState HistoryItemToPageState( Does this need ...
7 years, 7 months ago (2013-05-17 04:57:10 UTC) #4
darin (slow to review)
On 2013/05/17 04:57:10, brettw wrote: > PageState seems fine. > > https://codereview.chromium.org/14985014/diff/7001/content/public/renderer/history_item_serialization.h > File content/public/renderer/history_item_serialization.h ...
7 years, 7 months ago (2013-05-23 06:46:51 UTC) #5
darin (slow to review)
This is ready for a real code review. Thanks in advance!
7 years, 7 months ago (2013-05-23 19:40:57 UTC) #6
brettw
LGTM, surprisingly simple once you get into it. https://codereview.chromium.org/14985014/diff/50001/content/public/common/page_state.h File content/public/common/page_state.h (right): https://codereview.chromium.org/14985014/diff/50001/content/public/common/page_state.h#newcode43 content/public/common/page_state.h:43: bool ...
7 years, 7 months ago (2013-05-23 23:38:39 UTC) #7
darin (slow to review)
On 2013/05/23 23:38:39, brettw wrote: > LGTM, surprisingly simple once you get into it. > ...
7 years, 7 months ago (2013-05-24 06:34:58 UTC) #8
darin (slow to review)
+tsepez for IPC review Tom, with this change the "content state" strings get replaced by ...
7 years, 7 months ago (2013-05-24 07:30:42 UTC) #9
Tom Sepez
Darin, this is a good step to making this clearer. LGTM with comments. https://codereview.chromium.org/14985014/diff/50001/chrome/browser/ui/browser_commands.cc File ...
7 years, 7 months ago (2013-05-24 17:46:48 UTC) #10
Tom Sepez
s/hate/have/ in page_state.h comment :).
7 years, 7 months ago (2013-05-24 17:47:41 UTC) #11
darin (slow to review)
On 2013/05/24 17:46:48, Tom Sepez wrote: > Darin, this is a good step to making ...
7 years, 7 months ago (2013-05-24 21:02:26 UTC) #12
Tom Sepez
> being on PageState? Are you just worried about binary bloat? Yep, just wanted to ...
7 years, 7 months ago (2013-05-24 21:24:22 UTC) #13
darin (slow to review)
7 years, 7 months ago (2013-05-24 22:01:23 UTC) #14
Message was sent while issue was closed.
Committed patchset #13 manually as r202188 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698