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

Side by Side Diff: ios/web/net/request_tracker_impl.mm

Issue 2247303009: Converts ios/web/net to ARC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ios-web
Patch Set: Removes web_arc_transition temporary target Created 4 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/web/net/request_tracker_impl.h" 5 #include "ios/web/net/request_tracker_impl.h"
6 6
7 #include <pthread.h> 7 #include <pthread.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 15 matching lines...) Expand all
26 #include "ios/web/public/cert_store.h" 26 #include "ios/web/public/cert_store.h"
27 #include "ios/web/public/certificate_policy_cache.h" 27 #include "ios/web/public/certificate_policy_cache.h"
28 #include "ios/web/public/ssl_status.h" 28 #include "ios/web/public/ssl_status.h"
29 #include "ios/web/public/url_util.h" 29 #include "ios/web/public/url_util.h"
30 #include "ios/web/public/web_thread.h" 30 #include "ios/web/public/web_thread.h"
31 #import "net/base/mac/url_conversions.h" 31 #import "net/base/mac/url_conversions.h"
32 #include "net/base/net_errors.h" 32 #include "net/base/net_errors.h"
33 #include "net/http/http_response_headers.h" 33 #include "net/http/http_response_headers.h"
34 #include "net/url_request/url_request.h" 34 #include "net/url_request/url_request.h"
35 35
36 #if !defined(__has_feature) || !__has_feature(objc_arc)
37 #error "This file requires ARC support."
38 #endif
39
36 namespace { 40 namespace {
37 41
38 struct EqualNSStrings { 42 struct EqualNSStrings {
39 bool operator()(const base::scoped_nsobject<NSString>& s1, 43 bool operator()(const base::scoped_nsobject<NSString>& s1,
40 const base::scoped_nsobject<NSString>& s2) const { 44 const base::scoped_nsobject<NSString>& s2) const {
41 // Use a ternary due to the BOOL vs bool type difference. 45 // Use a ternary due to the BOOL vs bool type difference.
42 return [s1 isEqualToString:s2] ? true : false; 46 return [s1 isEqualToString:s2] ? true : false;
43 } 47 }
44 }; 48 };
45 49
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 251
248 - (const net::SSLInfo&)sslInfo { 252 - (const net::SSLInfo&)sslInfo {
249 return sslInfo_; 253 return sslInfo_;
250 } 254 }
251 255
252 - (const web::SSLStatus&)sslStatus { 256 - (const web::SSLStatus&)sslStatus {
253 return status_; 257 return status_;
254 } 258 }
255 259
256 - (void)errorCallback:(BOOL)flag { 260 - (void)errorCallback:(BOOL)flag {
257 base::scoped_nsobject<CRWSSLCarrier> scoped([self retain]); 261 base::scoped_nsobject<CRWSSLCarrier> scoped(self);
258 web::WebThread::PostTask(web::WebThread::IO, FROM_HERE, 262 web::WebThread::PostTask(web::WebThread::IO, FROM_HERE,
259 base::Bind(&web::RequestTrackerImpl::ErrorCallback, 263 base::Bind(&web::RequestTrackerImpl::ErrorCallback,
260 tracker_, scoped, flag)); 264 tracker_, scoped, flag));
261 } 265 }
262 266
263 - (void)buildSSLStatus { 267 - (void)buildSSLStatus {
264 DCHECK_CURRENTLY_ON(web::WebThread::IO); 268 DCHECK_CURRENTLY_ON(web::WebThread::IO);
265 if (!sslInfo_.is_valid()) 269 if (!sslInfo_.is_valid())
266 return; 270 return;
267 271
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // Take care of the IO-thread init. 365 // Take care of the IO-thread init.
362 web::WebThread::PostTask( 366 web::WebThread::PostTask(
363 web::WebThread::IO, FROM_HERE, 367 web::WebThread::IO, FROM_HERE,
364 base::Bind(&RequestTrackerImpl::InitOnIOThread, tracker, policy_cache)); 368 base::Bind(&RequestTrackerImpl::InitOnIOThread, tracker, policy_cache));
365 RegisterTracker(tracker.get(), request_group_id); 369 RegisterTracker(tracker.get(), request_group_id);
366 return tracker; 370 return tracker;
367 } 371 }
368 372
369 void RequestTrackerImpl::StartPageLoad(const GURL& url, id user_info) { 373 void RequestTrackerImpl::StartPageLoad(const GURL& url, id user_info) {
370 DCHECK_CURRENTLY_ON(web::WebThread::UI); 374 DCHECK_CURRENTLY_ON(web::WebThread::UI);
371 base::scoped_nsobject<id> scoped_user_info([user_info retain]); 375 base::scoped_nsobject<id> scoped_user_info(user_info);
372 web::WebThread::PostTask( 376 web::WebThread::PostTask(
373 web::WebThread::IO, FROM_HERE, 377 web::WebThread::IO, FROM_HERE,
374 base::Bind(&RequestTrackerImpl::TrimToURL, this, url, scoped_user_info)); 378 base::Bind(&RequestTrackerImpl::TrimToURL, this, url, scoped_user_info));
375 } 379 }
376 380
377 void RequestTrackerImpl::FinishPageLoad(const GURL& url, bool load_success) { 381 void RequestTrackerImpl::FinishPageLoad(const GURL& url, bool load_success) {
378 DCHECK_CURRENTLY_ON(web::WebThread::UI); 382 DCHECK_CURRENTLY_ON(web::WebThread::UI);
379 web::WebThread::PostTask( 383 web::WebThread::PostTask(
380 web::WebThread::IO, FROM_HERE, 384 web::WebThread::IO, FROM_HERE,
381 base::Bind(&RequestTrackerImpl::StopPageLoad, this, url, load_success)); 385 base::Bind(&RequestTrackerImpl::StopPageLoad, this, url, load_success));
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 // about those anymore. Cancel the request. 1224 // about those anymore. Cancel the request.
1221 if ((*it)->ssl_judgment == CertPolicy::UNKNOWN) 1225 if ((*it)->ssl_judgment == CertPolicy::UNKNOWN)
1222 CancelRequestForCounts(*it); 1226 CancelRequestForCounts(*it);
1223 counts_by_request_.erase((*it)->request); 1227 counts_by_request_.erase((*it)->request);
1224 } 1228 }
1225 it = counts_.erase(it); 1229 it = counts_.erase(it);
1226 } 1230 }
1227 1231
1228 has_mixed_content_ = new_url_has_mixed_content; 1232 has_mixed_content_ = new_url_has_mixed_content;
1229 page_url_ = url; 1233 page_url_ = url;
1230 user_info_.reset([user_info retain]); 1234 user_info_.reset(user_info);
1231 estimate_start_index_ = 0; 1235 estimate_start_index_ = 0;
1232 is_loading_ = true; 1236 is_loading_ = true;
1233 previous_estimate_ = 0.0f; 1237 previous_estimate_ = 0.0f;
1234 new_estimate_round_ = true; 1238 new_estimate_round_ = true;
1235 ReevaluateCallbacksForAllCounts(); 1239 ReevaluateCallbacksForAllCounts();
1236 Notify(); 1240 Notify();
1237 } 1241 }
1238 1242
1239 void RequestTrackerImpl::StopPageLoad(const GURL& url, bool load_success) { 1243 void RequestTrackerImpl::StopPageLoad(const GURL& url, bool load_success) {
1240 DCHECK_CURRENTLY_ON(web::WebThread::IO); 1244 DCHECK_CURRENTLY_ON(web::WebThread::IO);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 })); 1309 }));
1306 } 1310 }
1307 } 1311 }
1308 1312
1309 void RequestTrackerImpl::SetCertificatePolicyCacheForTest( 1313 void RequestTrackerImpl::SetCertificatePolicyCacheForTest(
1310 web::CertificatePolicyCache* cache) { 1314 web::CertificatePolicyCache* cache) {
1311 policy_cache_ = cache; 1315 policy_cache_ = cache;
1312 } 1316 }
1313 1317
1314 } // namespace web 1318 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698