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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "base/callback.h" | 52 #include "base/callback.h" |
53 #include "base/logging.h" | 53 #include "base/logging.h" |
54 #include "base/memory/scoped_ptr.h" | 54 #include "base/memory/scoped_ptr.h" |
55 #include "base/message_loop.h" | 55 #include "base/message_loop.h" |
56 #include "base/message_loop_proxy.h" | 56 #include "base/message_loop_proxy.h" |
57 #include "base/metrics/histogram.h" | 57 #include "base/metrics/histogram.h" |
58 #include "base/string_util.h" | 58 #include "base/string_util.h" |
59 #include "base/stringprintf.h" | 59 #include "base/stringprintf.h" |
60 #include "googleurl/src/gurl.h" | 60 #include "googleurl/src/gurl.h" |
61 #include "net/cookies/canonical_cookie.h" | 61 #include "net/cookies/canonical_cookie.h" |
| 62 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
62 #include "net/cookies/cookie_util.h" | 63 #include "net/cookies/cookie_util.h" |
63 #include "net/cookies/parsed_cookie.h" | 64 #include "net/cookies/parsed_cookie.h" |
64 #include "net/base/registry_controlled_domain.h" | |
65 | 65 |
66 using base::Time; | 66 using base::Time; |
67 using base::TimeDelta; | 67 using base::TimeDelta; |
68 using base::TimeTicks; | 68 using base::TimeTicks; |
69 | 69 |
70 // In steady state, most cookie requests can be satisfied by the in memory | 70 // In steady state, most cookie requests can be satisfied by the in memory |
71 // cookie monster store. However, if a request comes in during the initial | 71 // cookie monster store. However, if a request comes in during the initial |
72 // cookie load, it must be delayed until that load completes. That is done by | 72 // cookie load, it must be delayed until that load completes. That is done by |
73 // queueing it on CookieMonster::queue_ and running it when notification of | 73 // queueing it on CookieMonster::queue_ and running it when notification of |
74 // cookie load completion is received via CookieMonster::OnLoaded. This callback | 74 // cookie load completion is received via CookieMonster::OnLoaded. This callback |
(...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2149 | 2149 |
2150 // The system resolution is not high enough, so we can have multiple | 2150 // The system resolution is not high enough, so we can have multiple |
2151 // set cookies that result in the same system time. When this happens, we | 2151 // set cookies that result in the same system time. When this happens, we |
2152 // increment by one Time unit. Let's hope computers don't get too fast. | 2152 // increment by one Time unit. Let's hope computers don't get too fast. |
2153 Time CookieMonster::CurrentTime() { | 2153 Time CookieMonster::CurrentTime() { |
2154 return std::max(Time::Now(), | 2154 return std::max(Time::Now(), |
2155 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1)); | 2155 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1)); |
2156 } | 2156 } |
2157 | 2157 |
2158 } // namespace net | 2158 } // namespace net |
OLD | NEW |