| 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 memory | 5 package memory |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "fmt" | 9 "fmt" |
| 10 "sort" | 10 "sort" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 buf := &bytes.Buffer{} | 67 buf := &bytes.Buffer{} |
| 68 ret = make(serializedIndexablePmap, len(pm)) | 68 ret = make(serializedIndexablePmap, len(pm)) |
| 69 for k, vals := range pm { | 69 for k, vals := range pm { |
| 70 newVals := make(serializedPvals, 0, len(vals)) | 70 newVals := make(serializedPvals, 0, len(vals)) |
| 71 for _, v := range vals { | 71 for _, v := range vals { |
| 72 if v.IndexSetting() == rds.NoIndex { | 72 if v.IndexSetting() == rds.NoIndex { |
| 73 continue | 73 continue |
| 74 } | 74 } |
| 75 buf.Reset() | 75 buf.Reset() |
| 76 » » » rds.WriteProperty(buf, v, rds.WithoutContext) | 76 » » » v.Write(buf, rds.WithoutContext) |
| 77 newVal := make([]byte, buf.Len()) | 77 newVal := make([]byte, buf.Len()) |
| 78 copy(newVal, buf.Bytes()) | 78 copy(newVal, buf.Bytes()) |
| 79 newVals = append(newVals, newVal) | 79 newVals = append(newVals, newVal) |
| 80 } | 80 } |
| 81 if len(newVals) > 0 { | 81 if len(newVals) > 0 { |
| 82 sort.Sort(newVals) | 82 sort.Sort(newVals) |
| 83 ret[k] = newVals | 83 ret[k] = newVals |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 return | 86 return |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 coll.Set(k, nv) | 280 coll.Set(k, nv) |
| 281 } | 281 } |
| 282 }) | 282 }) |
| 283 default: | 283 default: |
| 284 panic("impossible") | 284 panic("impossible") |
| 285 } | 285 } |
| 286 // TODO(riannucci): remove entries from idxColl and remove index
collections | 286 // TODO(riannucci): remove entries from idxColl and remove index
collections |
| 287 // when there are no index entries for that index any more. | 287 // when there are no index entries for that index any more. |
| 288 }) | 288 }) |
| 289 } | 289 } |
| OLD | NEW |