Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: ios/net/cookies/cookie_store_ios.mm

Issue 2671713006: [Cronet] Don't spam log if system cookie doesn't have creation time. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/net/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "ios/net/cookies/cookie_store_ios.h" 5 #include "ios/net/cookies/cookie_store_ios.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 10 matching lines...) Expand all
21 #include "base/metrics/histogram_macros.h" 21 #include "base/metrics/histogram_macros.h"
22 #include "base/observer_list.h" 22 #include "base/observer_list.h"
23 #include "base/sequenced_task_runner.h" 23 #include "base/sequenced_task_runner.h"
24 #include "base/strings/sys_string_conversions.h" 24 #include "base/strings/sys_string_conversions.h"
25 #include "base/task_runner_util.h" 25 #include "base/task_runner_util.h"
26 #include "base/threading/thread_restrictions.h" 26 #include "base/threading/thread_restrictions.h"
27 #include "base/threading/thread_task_runner_handle.h" 27 #include "base/threading/thread_task_runner_handle.h"
28 #include "ios/net/cookies/cookie_creation_time_manager.h" 28 #include "ios/net/cookies/cookie_creation_time_manager.h"
29 #include "ios/net/cookies/cookie_store_ios_client.h" 29 #include "ios/net/cookies/cookie_store_ios_client.h"
30 #include "ios/net/cookies/system_cookie_util.h" 30 #include "ios/net/cookies/system_cookie_util.h"
31 #include "ios/net/ios_net_features.h"
31 #import "net/base/mac/url_conversions.h" 32 #import "net/base/mac/url_conversions.h"
32 #include "net/cookies/cookie_util.h" 33 #include "net/cookies/cookie_util.h"
33 #include "net/cookies/parsed_cookie.h" 34 #include "net/cookies/parsed_cookie.h"
34 #include "url/gurl.h" 35 #include "url/gurl.h"
35 36
36 #if !defined(__has_feature) || !__has_feature(objc_arc) 37 #if !defined(__has_feature) || !__has_feature(objc_arc)
37 #error "This file requires ARC support." 38 #error "This file requires ARC support."
38 #endif 39 #endif
39 40
40 namespace net { 41 namespace net {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (path_length_a < path_length_b) 169 if (path_length_a < path_length_b)
169 return NSOrderedDescending; 170 return NSOrderedDescending;
170 if (path_length_b < path_length_a) 171 if (path_length_b < path_length_a)
171 return NSOrderedAscending; 172 return NSOrderedAscending;
172 173
173 // Compare creation times. 174 // Compare creation times.
174 CookieCreationTimeManager* manager = (CookieCreationTimeManager*)context; 175 CookieCreationTimeManager* manager = (CookieCreationTimeManager*)context;
175 DCHECK(manager); 176 DCHECK(manager);
176 base::Time created_a = manager->GetCreationTime(cookie_a); 177 base::Time created_a = manager->GetCreationTime(cookie_a);
177 base::Time created_b = manager->GetCreationTime(cookie_b); 178 base::Time created_b = manager->GetCreationTime(cookie_b);
178 #if !defined(CRNET) 179 #if !BUILDFLAG(CRONET_BUILD)
179 // CookieCreationTimeManager is returning creation times that are null. 180 // CookieCreationTimeManager is returning creation times that are null.
180 // Since in CrNet, the cookie store is recreated on startup, let's suppress 181 // Since in Cronet, the cookie store is recreated on startup, let's suppress
181 // this warning for now. 182 // this warning for now.
182 // TODO(huey): Instead of suppressing the warning, assign a creation time 183 // TODO(mef): Instead of suppressing the warning, assign a creation time
183 // to cookies if one doesn't already exist. 184 // to cookies if one doesn't already exist.
184 DLOG_IF(ERROR, created_a.is_null() || created_b.is_null()) 185 DLOG_IF(ERROR, created_a.is_null() || created_b.is_null())
185 << "Cookie without creation date"; 186 << "Cookie without creation date";
186 #endif 187 #endif
187 if (created_a < created_b) 188 if (created_a < created_b)
188 return NSOrderedAscending; 189 return NSOrderedAscending;
189 return (created_a > created_b) ? NSOrderedDescending : NSOrderedSame; 190 return (created_a > created_b) ? NSOrderedDescending : NSOrderedSame;
190 } 191 }
191 192
192 // Gets the cookies for |url| from the system cookie store. 193 // Gets the cookies for |url| from the system cookie store.
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 net::CookieList cookie_list; 832 net::CookieList cookie_list;
832 cookie_list.reserve([cookies count]); 833 cookie_list.reserve([cookies count]);
833 for (NSHTTPCookie* cookie in cookies) { 834 for (NSHTTPCookie* cookie in cookies) {
834 base::Time created = creation_time_manager_->GetCreationTime(cookie); 835 base::Time created = creation_time_manager_->GetCreationTime(cookie);
835 cookie_list.push_back(CanonicalCookieFromSystemCookie(cookie, created)); 836 cookie_list.push_back(CanonicalCookieFromSystemCookie(cookie, created));
836 } 837 }
837 return cookie_list; 838 return cookie_list;
838 } 839 }
839 840
840 } // namespace net 841 } // namespace net
OLDNEW
« no previous file with comments | « ios/net/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698