diff options
author | tyoshino@google.com <tyoshino@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-17 03:51:33 +0000 |
---|---|---|
committer | tyoshino@google.com <tyoshino@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-17 03:51:33 +0000 |
commit | d3c3274426c2f6b9f1796cda6d5b4466237cfaf7 (patch) | |
tree | 764b99016975d8c56a44b58d3de3398381c32e73 /net/ftp/ftp_auth_cache.cc | |
parent | 48e144ee5faf657841f2051f9a94b46b8a96fc89 (diff) | |
download | chromium_src-d3c3274426c2f6b9f1796cda6d5b4466237cfaf7.zip chromium_src-d3c3274426c2f6b9f1796cda6d5b4466237cfaf7.tar.gz chromium_src-d3c3274426c2f6b9f1796cda6d5b4466237cfaf7.tar.bz2 |
Reverting 26419.
Looks like this CL caused failure in Modules Linux (valgrind)
http://chrome-buildbot.corp.google.com:8010/builders/Modules%20Linux%20(valgrind)/builds/1104/steps/valgrind%20test:%20base/logs/stdio
http://chrome-buildbot.corp.google.com:8010/builders/Modules%20Linux%20(valgrind)/builds/1103/steps/valgrind%20test:%20base/logs/stdio
[----------] 6 tests from ClipboardTest
[ RUN ] ClipboardTest.ClearTest
command timed out: 1200 seconds without output, killing pid 7479
process killed by signal 9
program finished with exit code -1
TBR=phajdan.jr
Review URL: http://codereview.chromium.org/212007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp/ftp_auth_cache.cc')
-rw-r--r-- | net/ftp/ftp_auth_cache.cc | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/net/ftp/ftp_auth_cache.cc b/net/ftp/ftp_auth_cache.cc index d3bff90..c29146a 100644 --- a/net/ftp/ftp_auth_cache.cc +++ b/net/ftp/ftp_auth_cache.cc @@ -12,25 +12,20 @@ namespace net { // static const size_t FtpAuthCache::kMaxEntries = 10; -FtpAuthCache::Entry* FtpAuthCache::Lookup(const GURL& origin) { - for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) { - if (it->origin == origin) - return &(*it); - } - return NULL; +AuthData* FtpAuthCache::Lookup(const GURL& origin) { + Entry* entry = LookupEntry(origin); + return (entry ? entry->auth_data : NULL); } -void FtpAuthCache::Add(const GURL& origin, const std::wstring& username, - const std::wstring& password) { +void FtpAuthCache::Add(const GURL& origin, AuthData* auth_data) { DCHECK(origin.SchemeIs("ftp")); DCHECK_EQ(origin.GetOrigin(), origin); - Entry* entry = Lookup(origin); + Entry* entry = LookupEntry(origin); if (entry) { - entry->username = username; - entry->password = password; + entry->auth_data = auth_data; } else { - entries_.push_front(Entry(origin, username, password)); + entries_.push_front(Entry(origin, auth_data)); // Prevent unbound memory growth of the cache. if (entries_.size() > kMaxEntries) @@ -38,16 +33,22 @@ void FtpAuthCache::Add(const GURL& origin, const std::wstring& username, } } -void FtpAuthCache::Remove(const GURL& origin, const std::wstring& username, - const std::wstring& password) { +void FtpAuthCache::Remove(const GURL& origin) { for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) { - if (it->origin == origin && it->username == username && - it->password == password) { + if (it->origin == origin) { entries_.erase(it); - DCHECK(!Lookup(origin)); + DCHECK(!LookupEntry(origin)); return; } } } +FtpAuthCache::Entry* FtpAuthCache::LookupEntry(const GURL& origin) { + for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) { + if (it->origin == origin) + return &(*it); + } + return NULL; +} + } // namespace net |