| 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 bundler | 5 package bundler |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "container/heap" | 8 "container/heap" |
| 9 "fmt" | 9 "fmt" |
| 10 "sync" | 10 "sync" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 }, | 112 }, |
| 113 } | 113 } |
| 114 | 114 |
| 115 err := error(nil) | 115 err := error(nil) |
| 116 c.parser, err = newParser(&p, &b.prefixCounter) | 116 c.parser, err = newParser(&p, &b.prefixCounter) |
| 117 if err != nil { | 117 if err != nil { |
| 118 return nil, fmt.Errorf("failed to create stream parser: %s", err
) | 118 return nil, fmt.Errorf("failed to create stream parser: %s", err
) |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Generate a secret for this Stream instance. | 121 // Generate a secret for this Stream instance. |
| 122 » c.template.Secret, err = types.NewStreamSecret() | 122 » c.template.Secret, err = types.NewPrefixSecret() |
| 123 if err != nil { | 123 if err != nil { |
| 124 return nil, fmt.Errorf("failed to generate stream secret: %s", e
rr) | 124 return nil, fmt.Errorf("failed to generate stream secret: %s", e
rr) |
| 125 } | 125 } |
| 126 | 126 |
| 127 b.streamsLock.Lock() | 127 b.streamsLock.Lock() |
| 128 defer b.streamsLock.Unlock() | 128 defer b.streamsLock.Unlock() |
| 129 | 129 |
| 130 // Ensure that this is not a duplicate stream name. | 130 // Ensure that this is not a duplicate stream name. |
| 131 if s := b.streams[p.Name]; s != nil { | 131 if s := b.streams[p.Name]; s != nil { |
| 132 return nil, fmt.Errorf("a Stream is already registered for %q",
p.Name) | 132 return nil, fmt.Errorf("a Stream is already registered for %q",
p.Name) |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 490 |
| 491 func (s *streamState) Push(x interface{}) { | 491 func (s *streamState) Push(x interface{}) { |
| 492 s.streams = append(s.streams, x.(bundlerStream)) | 492 s.streams = append(s.streams, x.(bundlerStream)) |
| 493 } | 493 } |
| 494 | 494 |
| 495 func (s *streamState) Pop() interface{} { | 495 func (s *streamState) Pop() interface{} { |
| 496 last := s.streams[len(s.streams)-1] | 496 last := s.streams[len(s.streams)-1] |
| 497 s.streams = s.streams[:len(s.streams)-1] | 497 s.streams = s.streams[:len(s.streams)-1] |
| 498 return last | 498 return last |
| 499 } | 499 } |
| OLD | NEW |