Chromium Code Reviews| 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 local | 5 package local |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "io/ioutil" | 9 "io/ioutil" |
| 10 "os" | 10 "os" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 return &fsImplErr{err} | 74 return &fsImplErr{err} |
| 75 } | 75 } |
| 76 return &fsImpl{abs, logger} | 76 return &fsImpl{abs, logger} |
| 77 } | 77 } |
| 78 | 78 |
| 79 // fsImplErr implements FileSystem by returning given error from all methods. | 79 // fsImplErr implements FileSystem by returning given error from all methods. |
| 80 type fsImplErr struct { | 80 type fsImplErr struct { |
| 81 err error | 81 err error |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Root returns absolute path to a directory FileSystem operates in. All FS | |
|
tandrii(chromium)
2015/09/30 18:11:15
why is this no longer the case?
Vadim Sh.
2015/09/30 22:50:59
It is still the case. It was mistakenly copy-paste
tandrii_google
2015/09/30 23:11:00
Acknowledged.
| |
| 85 // actions are restricted to this directory. | |
| 86 func (f *fsImplErr) Root() string { return "" } | 84 func (f *fsImplErr) Root() string { return "" } |
| 87 func (f *fsImplErr) CwdRelToAbs(path string) (string, error) { return "", f.err } | 85 func (f *fsImplErr) CwdRelToAbs(path string) (string, error) { return "", f.err } |
| 88 func (f *fsImplErr) RootRelToAbs(path string) (string, error) { return "", f.err } | 86 func (f *fsImplErr) RootRelToAbs(path string) (string, error) { return "", f.err } |
| 89 func (f *fsImplErr) EnsureDirectory(path string) (string, error) { return "", f.err } | 87 func (f *fsImplErr) EnsureDirectory(path string) (string, error) { return "", f.err } |
| 90 func (f *fsImplErr) EnsureSymlink(path string, target string) error { return f.err } | 88 func (f *fsImplErr) EnsureSymlink(path string, target string) error { return f.err } |
| 91 func (f *fsImplErr) EnsureFile(path string, body []byte, perm os.FileMode) error { return f.err } | 89 func (f *fsImplErr) EnsureFile(path string, body []byte, perm os.FileMode) error { return f.err } |
| 92 func (f *fsImplErr) EnsureFileGone(path string) error { return f.err } | 90 func (f *fsImplErr) EnsureFileGone(path string) error { return f.err } |
| 93 func (f *fsImplErr) EnsureDirectoryGone(path string) error { return f.err } | 91 func (f *fsImplErr) EnsureDirectoryGone(path string) error { return f.err } |
| 94 func (f *fsImplErr) Replace(oldpath, newpath string) error { return f.err } | 92 func (f *fsImplErr) Replace(oldpath, newpath string) error { return f.err } |
| 95 | 93 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 func pseudoRand() string { | 308 func pseudoRand() string { |
| 311 ts := time.Now().UnixNano() | 309 ts := time.Now().UnixNano() |
| 312 lastUsedTimeLock.Lock() | 310 lastUsedTimeLock.Lock() |
| 313 if ts <= lastUsedTime { | 311 if ts <= lastUsedTime { |
| 314 ts = lastUsedTime + 1 | 312 ts = lastUsedTime + 1 |
| 315 } | 313 } |
| 316 lastUsedTime = ts | 314 lastUsedTime = ts |
| 317 lastUsedTimeLock.Unlock() | 315 lastUsedTimeLock.Unlock() |
| 318 return fmt.Sprintf("%v_%v", os.Getpid(), ts) | 316 return fmt.Sprintf("%v_%v", os.Getpid(), ts) |
| 319 } | 317 } |
| OLD | NEW |