| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Portions of this code based on Mozilla: | 5 // Portions of this code based on Mozilla: |
| 6 // (netwerk/cookie/src/nsCookieService.cpp) | 6 // (netwerk/cookie/src/nsCookieService.cpp) |
| 7 /* ***** BEGIN LICENSE BLOCK ***** | 7 /* ***** BEGIN LICENSE BLOCK ***** |
| 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 9 * | 9 * |
| 10 * The contents of this file are subject to the Mozilla Public License Version | 10 * The contents of this file are subject to the Mozilla Public License Version |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "base/basictypes.h" | 51 #include "base/basictypes.h" |
| 52 #include "base/bind.h" | 52 #include "base/bind.h" |
| 53 #include "base/callback.h" | 53 #include "base/callback.h" |
| 54 #include "base/logging.h" | 54 #include "base/logging.h" |
| 55 #include "base/memory/scoped_ptr.h" | 55 #include "base/memory/scoped_ptr.h" |
| 56 #include "base/message_loop.h" | 56 #include "base/message_loop.h" |
| 57 #include "base/message_loop/message_loop_proxy.h" | 57 #include "base/message_loop/message_loop_proxy.h" |
| 58 #include "base/metrics/histogram.h" | 58 #include "base/metrics/histogram.h" |
| 59 #include "base/strings/string_util.h" | 59 #include "base/strings/string_util.h" |
| 60 #include "base/strings/stringprintf.h" | 60 #include "base/strings/stringprintf.h" |
| 61 #include "googleurl/src/gurl.h" | |
| 62 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 61 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 63 #include "net/cookies/canonical_cookie.h" | 62 #include "net/cookies/canonical_cookie.h" |
| 64 #include "net/cookies/cookie_util.h" | 63 #include "net/cookies/cookie_util.h" |
| 65 #include "net/cookies/parsed_cookie.h" | 64 #include "net/cookies/parsed_cookie.h" |
| 65 #include "url/gurl.h" |
| 66 | 66 |
| 67 using base::Time; | 67 using base::Time; |
| 68 using base::TimeDelta; | 68 using base::TimeDelta; |
| 69 using base::TimeTicks; | 69 using base::TimeTicks; |
| 70 | 70 |
| 71 // In steady state, most cookie requests can be satisfied by the in memory | 71 // In steady state, most cookie requests can be satisfied by the in memory |
| 72 // cookie monster store. However, if a request comes in during the initial | 72 // cookie monster store. However, if a request comes in during the initial |
| 73 // cookie load, it must be delayed until that load completes. That is done by | 73 // cookie load, it must be delayed until that load completes. That is done by |
| 74 // queueing it on CookieMonster::tasks_pending_ and running it when notification | 74 // queueing it on CookieMonster::tasks_pending_ and running it when notification |
| 75 // of cookie load completion is received via CookieMonster::OnLoaded. This | 75 // of cookie load completion is received via CookieMonster::OnLoaded. This |
| (...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2150 | 2150 |
| 2151 // The system resolution is not high enough, so we can have multiple | 2151 // The system resolution is not high enough, so we can have multiple |
| 2152 // set cookies that result in the same system time. When this happens, we | 2152 // set cookies that result in the same system time. When this happens, we |
| 2153 // increment by one Time unit. Let's hope computers don't get too fast. | 2153 // increment by one Time unit. Let's hope computers don't get too fast. |
| 2154 Time CookieMonster::CurrentTime() { | 2154 Time CookieMonster::CurrentTime() { |
| 2155 return std::max(Time::Now(), | 2155 return std::max(Time::Now(), |
| 2156 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1)); | 2156 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1)); |
| 2157 } | 2157 } |
| 2158 | 2158 |
| 2159 } // namespace net | 2159 } // namespace net |
| OLD | NEW |