| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package mojom | 5 package mojom |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 ) | 9 ) |
| 10 | 10 |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 467 } |
| 468 | 468 |
| 469 /////////////////////////////////////////////////////////////////////// | 469 /////////////////////////////////////////////////////////////////////// |
| 470 /// Miscelleneous utilities | 470 /// Miscelleneous utilities |
| 471 /// ////////////////////////////////////////////////////////////////// | 471 /// ////////////////////////////////////////////////////////////////// |
| 472 | 472 |
| 473 func computeTypeKey(fullyQualifiedName string) (typeKey string) { | 473 func computeTypeKey(fullyQualifiedName string) (typeKey string) { |
| 474 if typeKey, ok := fqnToTypeKey[fullyQualifiedName]; ok == true { | 474 if typeKey, ok := fqnToTypeKey[fullyQualifiedName]; ok == true { |
| 475 return typeKey | 475 return typeKey |
| 476 } | 476 } |
| 477 » typeKey = fmt.Sprintf("%d", nextKey) | 477 » // TODO(rudominer) Until we understand better what the requirements are
for a type key |
| 478 » nextKey++ | 478 » // let's just use the fully-qualified name itself, with a prefix prepend
ed, as the type key. |
| 479 » // The reason or the prefix is pragmatic: When debugging we can tell whe
ther a string |
| 480 » // is a type key or a fully-qualified-name. |
| 481 » typeKey = fmt.Sprintf("TYPE_KEY:%s", fullyQualifiedName) |
| 479 fqnToTypeKey[fullyQualifiedName] = typeKey | 482 fqnToTypeKey[fullyQualifiedName] = typeKey |
| 480 return | 483 return |
| 481 } | 484 } |
| 482 | 485 |
| 483 var fqnToTypeKey map[string]string | 486 var fqnToTypeKey map[string]string |
| 484 var nextKey int | |
| 485 | 487 |
| 486 func init() { | 488 func init() { |
| 487 fqnToTypeKey = make(map[string]string) | 489 fqnToTypeKey = make(map[string]string) |
| 488 } | 490 } |
| OLD | NEW |