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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/surface_id.mojom.dart

Issue 1449203002: Check in generated Dart bindings and add presubmit script (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: mojo/dart/packages/mojo_services/lib/mojo/surface_id.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/surface_id.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/surface_id.mojom.dart
new file mode 100644
index 0000000000000000000000000000000000000000..05d9a900d5fd115a94698f5ff42390ed2c7332f0
--- /dev/null
+++ b/mojo/dart/packages/mojo_services/lib/mojo/surface_id.mojom.dart
@@ -0,0 +1,89 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+library surface_id_mojom;
+
+import 'dart:async';
+
+import 'package:mojo/bindings.dart' as bindings;
+import 'package:mojo/core.dart' as core;
+
+
+
+class SurfaceId extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(16, 0)
+ ];
+ int local = 0;
+ int idNamespace = 0;
+
+ SurfaceId() : super(kVersions.last.size);
+
+ static SurfaceId deserialize(bindings.Message message) {
+ var decoder = new bindings.Decoder(message);
+ var result = decode(decoder);
+ if (decoder.excessHandles != null) {
+ decoder.excessHandles.forEach((h) => h.close());
+ }
+ return result;
+ }
+
+ static SurfaceId decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ SurfaceId result = new SurfaceId();
+
+ var mainDataHeader = decoder0.decodeStructDataHeader();
+ if (mainDataHeader.version <= kVersions.last.version) {
+ // Scan in reverse order to optimize for more recent versions.
+ for (int i = kVersions.length - 1; i >= 0; --i) {
+ if (mainDataHeader.version >= kVersions[i].version) {
+ if (mainDataHeader.size == kVersions[i].size) {
+ // Found a match.
+ break;
+ }
+ throw new bindings.MojoCodecError(
+ 'Header size doesn\'t correspond to known version size.');
+ }
+ }
+ } else if (mainDataHeader.size < kVersions.last.size) {
+ throw new bindings.MojoCodecError(
+ 'Message newer than the last known version cannot be shorter than '
+ 'required by the last known version.');
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.local = decoder0.decodeUint32(8);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.idNamespace = decoder0.decodeUint32(12);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeUint32(local, 8);
+
+ encoder0.encodeUint32(idNamespace, 12);
+ }
+
+ String toString() {
+ return "SurfaceId("
+ "local: $local" ", "
+ "idNamespace: $idNamespace" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["local"] = local;
+ map["idNamespace"] = idNamespace;
+ return map;
+ }
+}
+
+

Powered by Google App Engine
This is Rietveld 408576698