Commit b6cce2f0 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Mark mojom types which must be stable as [Stable]

Several mojom types are required to be stable over time by virtue of
their use in Content's page state serialization code.

Now that we have the [Stable] attribute with strict presubmit
enforcement, these types can all be marked [Stable] to ensure that they
aren't unwittingly broken by future changes.

Bug: 1070663
Change-Id: I7de41133eb8244f7dd8562fa713b6ad702c04ccb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220251
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773321}
parent b86921c7
...@@ -15,17 +15,16 @@ import "ui/gfx/geometry/mojom/geometry.mojom"; ...@@ -15,17 +15,16 @@ import "ui/gfx/geometry/mojom/geometry.mojom";
// parts. The resultant generated code is used to serialize and deserialize // parts. The resultant generated code is used to serialize and deserialize
// PageState for the purpose of history restore. // PageState for the purpose of history restore.
// //
// When adding fields: // All structures here must maintain backward-compatibility (and hence must be
// marked [Stable]) according to mojom backward-compatibility rules. Namely,
// when adding new fields:
// - Assign your new field an explicit ordinal(@n) and prefer to add fields to // - Assign your new field an explicit ordinal(@n) and prefer to add fields to
// the end of the struct to simplify finding the latest ordinal. // the end of the struct to simplify finding the latest ordinal.
// - For backwards compatibility purposes: // - New fields must be tagged with a [MinVersion=x] attribute where x is larger
// - New fields must be tagged with a [MinVersion=x] attribute; x is // than the MinVersion for any existing fields. The next available MinVersion
// specified at the bottom of this comment block. // value is specified at the bottom of this comment block for convenience.
// - Only types with frozen/unchanging Mojo serialization may be used; // - Only builtin mojom types or other user-defined [Stable] types are allowed
// for example, |string| is okay, but |url.mojom.Origin| is not. // as transitive dependencies here. This is enforced at build time.
// (note that if serialization of any of the types used in PageState
// changes in a backwards-incompatible way then it should be caught by
// one of PageStateSerializationTest, BackwardsCompat_vXX tests).
// - You'll also need to read/write the new field's value when decoding and // - You'll also need to read/write the new field's value when decoding and
// encoding PageState, update PageStateSerializationTest to check that your // encoding PageState, update PageStateSerializationTest to check that your
// new field is preserved across serialization, and add a BackwardsCompat // new field is preserved across serialization, and add a BackwardsCompat
...@@ -37,11 +36,15 @@ import "ui/gfx/geometry/mojom/geometry.mojom"; ...@@ -37,11 +36,15 @@ import "ui/gfx/geometry/mojom/geometry.mojom";
// compatibility. If re-ordering fields, make sure to retain the original // compatibility. If re-ordering fields, make sure to retain the original
// ordinal value. // ordinal value.
// //
// Finally, note that any backward-incomptable changes will be caught by a
// presubmit check.
//
// Update the below value if your change introduces fields using it. // Update the below value if your change introduces fields using it.
// Next MinVersion: 3 // Next MinVersion: 3
// Next Ordinal: 4 // Next Ordinal: 4
// FileSystemFile is no longer supported. // FileSystemFile is no longer supported.
[Stable]
struct DEPRECATED_FileSystemFile { struct DEPRECATED_FileSystemFile {
url.mojom.Url filesystem_url@0; url.mojom.Url filesystem_url@0;
uint64 offset@1; uint64 offset@1;
...@@ -50,6 +53,7 @@ struct DEPRECATED_FileSystemFile { ...@@ -50,6 +53,7 @@ struct DEPRECATED_FileSystemFile {
}; };
// Next Ordinal: 4 // Next Ordinal: 4
[Stable]
struct File { struct File {
mojo_base.mojom.String16 path@0; mojo_base.mojom.String16 path@0;
uint64 offset@1; uint64 offset@1;
...@@ -58,6 +62,7 @@ struct File { ...@@ -58,6 +62,7 @@ struct File {
}; };
// Next Ordinal: 4 // Next Ordinal: 4
[Stable]
union Element { union Element {
string blob_uuid@0; string blob_uuid@0;
array<uint8> bytes@1; array<uint8> bytes@1;
...@@ -67,6 +72,7 @@ union Element { ...@@ -67,6 +72,7 @@ union Element {
}; };
// Next Ordinal: 3 // Next Ordinal: 3
[Stable]
struct RequestBody { struct RequestBody {
array<Element> elements@0; array<Element> elements@0;
int64 identifier@1; int64 identifier@1;
...@@ -74,6 +80,7 @@ struct RequestBody { ...@@ -74,6 +80,7 @@ struct RequestBody {
}; };
// Next Ordinal: 3 // Next Ordinal: 3
[Stable]
struct HttpBody { struct HttpBody {
mojo_base.mojom.String16? http_content_type@0; mojo_base.mojom.String16? http_content_type@0;
RequestBody? request_body@1; RequestBody? request_body@1;
...@@ -82,13 +89,14 @@ struct HttpBody { ...@@ -82,13 +89,14 @@ struct HttpBody {
// This enum's values must match blink::WebHistoryScrollRestorationType. This // This enum's values must match blink::WebHistoryScrollRestorationType. This
// is enforced with static asserts in page_state_serialization.cc. // is enforced with static asserts in page_state_serialization.cc.
[Extensible] [Stable, Extensible]
enum ScrollRestorationType { enum ScrollRestorationType {
kAuto = 0, kAuto = 0,
kManual = 1 kManual = 1
}; };
// Next Ordinal: 6 // Next Ordinal: 6
[Stable]
struct ViewState { struct ViewState {
gfx.mojom.PointF visual_viewport_scroll_offset@0; gfx.mojom.PointF visual_viewport_scroll_offset@0;
gfx.mojom.Point scroll_offset@1; gfx.mojom.Point scroll_offset@1;
...@@ -100,6 +108,7 @@ struct ViewState { ...@@ -100,6 +108,7 @@ struct ViewState {
}; };
// Next Ordinal: 13 // Next Ordinal: 13
[Stable]
struct FrameState { struct FrameState {
mojo_base.mojom.String16? url_string@0; mojo_base.mojom.String16? url_string@0;
mojo_base.mojom.String16? referrer@1; mojo_base.mojom.String16? referrer@1;
...@@ -117,6 +126,7 @@ struct FrameState { ...@@ -117,6 +126,7 @@ struct FrameState {
}; };
// Next Ordinal: 2 // Next Ordinal: 2
[Stable]
struct PageState { struct PageState {
array<mojo_base.mojom.String16?> referenced_files@0; array<mojo_base.mojom.String16?> referenced_files@0;
FrameState top@1; FrameState top@1;
......
...@@ -9,10 +9,7 @@ import "mojo/public/mojom/base/big_buffer.mojom"; ...@@ -9,10 +9,7 @@ import "mojo/public/mojom/base/big_buffer.mojom";
// Corresponds to |base::string16| in base/strings/string16.h // Corresponds to |base::string16| in base/strings/string16.h
// Corresponds to |WTF::String| in // Corresponds to |WTF::String| in
// third_party/WebKit/Source/platform/wtf/text/WTFString.h. // third_party/WebKit/Source/platform/wtf/text/WTFString.h.
// Don't make backwards-incompatible changes to this definition! [Stable]
// It's used in PageState serialization, so backwards incompatible changes
// would cause stored PageState objects to be un-parseable. Please contact the
// page state serialization owners before making such a change.
struct String16 { struct String16 {
array<uint16> data; array<uint16> data;
}; };
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
module mojo_base.mojom; module mojo_base.mojom;
[Stable]
struct Time { struct Time {
// The internal value is expressed in terms of microseconds since a fixed but // The internal value is expressed in terms of microseconds since a fixed but
// intentionally unspecified epoch. // intentionally unspecified epoch.
......
...@@ -4,10 +4,7 @@ ...@@ -4,10 +4,7 @@
module network.mojom; module network.mojom;
// Don't make backwards-incompatible changes to this definition! [Stable]
// It's used in PageState serialization, so backwards incompatible changes
// would cause stored PageState objects to be un-parseable. Please contact the
// page state serialization owners before making such a change.
enum ReferrerPolicy { enum ReferrerPolicy {
kAlways, kAlways,
kDefault, kDefault,
......
...@@ -4,18 +4,13 @@ ...@@ -4,18 +4,13 @@
module gfx.mojom; module gfx.mojom;
// Don't make backwards-incompatible changes to this definition! [Stable]
// It's used in PageState serialization, so backwards incompatible changes
// would cause stored PageState objects to be un-parseable.
struct Point { struct Point {
int32 x; int32 x;
int32 y; int32 y;
}; };
// Don't make backwards-incompatible changes to this definition! [Stable]
// It's used in PageState serialization, so backwards incompatible changes
// would cause stored PageState objects to be un-parseable. Please contact the
// page state serialization owners before making such a change.
struct PointF { struct PointF {
float x; float x;
float y; float y;
......
...@@ -4,10 +4,7 @@ ...@@ -4,10 +4,7 @@
module url.mojom; module url.mojom;
// Don't make backwards-incompatible changes to this definition! [Stable]
// It's used in PageState serialization, so backwards incompatible changes
// would cause stored PageState objects to be un-parseable. Please contact the
// page state serialization owners before making such a change.
struct Url { struct Url {
string url; string url;
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment