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";
// parts. The resultant generated code is used to serialize and deserialize
// 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
// 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; x is
// specified at the bottom of this comment block.
// - Only types with frozen/unchanging Mojo serialization may be used;
// for example, |string| is okay, but |url.mojom.Origin| is not.
// (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).
// - New fields must be tagged with a [MinVersion=x] attribute where x is larger
// than the MinVersion for any existing fields. The next available MinVersion
// value is specified at the bottom of this comment block for convenience.
// - Only builtin mojom types or other user-defined [Stable] types are allowed
// as transitive dependencies here. This is enforced at build time.
// - You'll also need to read/write the new field's value when decoding and
// encoding PageState, update PageStateSerializationTest to check that your
// new field is preserved across serialization, and add a BackwardsCompat
......@@ -37,11 +36,15 @@ import "ui/gfx/geometry/mojom/geometry.mojom";
// compatibility. If re-ordering fields, make sure to retain the original
// 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.
// Next MinVersion: 3
// Next Ordinal: 4
// FileSystemFile is no longer supported.
[Stable]
struct DEPRECATED_FileSystemFile {
url.mojom.Url filesystem_url@0;
uint64 offset@1;
......@@ -50,6 +53,7 @@ struct DEPRECATED_FileSystemFile {
};
// Next Ordinal: 4
[Stable]
struct File {
mojo_base.mojom.String16 path@0;
uint64 offset@1;
......@@ -58,6 +62,7 @@ struct File {
};
// Next Ordinal: 4
[Stable]
union Element {
string blob_uuid@0;
array<uint8> bytes@1;
......@@ -67,6 +72,7 @@ union Element {
};
// Next Ordinal: 3
[Stable]
struct RequestBody {
array<Element> elements@0;
int64 identifier@1;
......@@ -74,6 +80,7 @@ struct RequestBody {
};
// Next Ordinal: 3
[Stable]
struct HttpBody {
mojo_base.mojom.String16? http_content_type@0;
RequestBody? request_body@1;
......@@ -82,13 +89,14 @@ struct HttpBody {
// This enum's values must match blink::WebHistoryScrollRestorationType. This
// is enforced with static asserts in page_state_serialization.cc.
[Extensible]
[Stable, Extensible]
enum ScrollRestorationType {
kAuto = 0,
kManual = 1
};
// Next Ordinal: 6
[Stable]
struct ViewState {
gfx.mojom.PointF visual_viewport_scroll_offset@0;
gfx.mojom.Point scroll_offset@1;
......@@ -100,6 +108,7 @@ struct ViewState {
};
// Next Ordinal: 13
[Stable]
struct FrameState {
mojo_base.mojom.String16? url_string@0;
mojo_base.mojom.String16? referrer@1;
......@@ -117,6 +126,7 @@ struct FrameState {
};
// Next Ordinal: 2
[Stable]
struct PageState {
array<mojo_base.mojom.String16?> referenced_files@0;
FrameState top@1;
......
......@@ -9,10 +9,7 @@ import "mojo/public/mojom/base/big_buffer.mojom";
// Corresponds to |base::string16| in base/strings/string16.h
// Corresponds to |WTF::String| in
// third_party/WebKit/Source/platform/wtf/text/WTFString.h.
// Don't make backwards-incompatible changes to this definition!
// 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.
[Stable]
struct String16 {
array<uint16> data;
};
......
......@@ -4,6 +4,7 @@
module mojo_base.mojom;
[Stable]
struct Time {
// The internal value is expressed in terms of microseconds since a fixed but
// intentionally unspecified epoch.
......
......@@ -4,10 +4,7 @@
module network.mojom;
// Don't make backwards-incompatible changes to this definition!
// 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.
[Stable]
enum ReferrerPolicy {
kAlways,
kDefault,
......
......@@ -4,18 +4,13 @@
module gfx.mojom;
// Don't make backwards-incompatible changes to this definition!
// It's used in PageState serialization, so backwards incompatible changes
// would cause stored PageState objects to be un-parseable.
[Stable]
struct Point {
int32 x;
int32 y;
};
// Don't make backwards-incompatible changes to this definition!
// 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.
[Stable]
struct PointF {
float x;
float y;
......
......@@ -4,10 +4,7 @@
module url.mojom;
// Don't make backwards-incompatible changes to this definition!
// 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.
[Stable]
struct Url {
string url;
};
\ No newline at end of file
};
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