| OLD | NEW |
| 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_factory_impl.h" | 5 #include "ios/web/net/request_tracker_factory_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "ios/web/net/request_group_util.h" | 10 #include "ios/web/net/request_group_util.h" |
| 11 #include "ios/web/net/request_tracker_impl.h" | 11 #include "ios/web/net/request_tracker_impl.h" |
| 12 | 12 |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 14 #error "This file requires ARC support." |
| 15 #endif |
| 16 |
| 13 namespace web { | 17 namespace web { |
| 14 | 18 |
| 15 RequestTrackerFactoryImpl::RequestTrackerFactoryImpl( | 19 RequestTrackerFactoryImpl::RequestTrackerFactoryImpl( |
| 16 const std::string& application_scheme) { | 20 const std::string& application_scheme) { |
| 17 if (!application_scheme.empty()) { | 21 if (!application_scheme.empty()) { |
| 18 application_scheme_.reset( | 22 application_scheme_.reset( |
| 19 [base::SysUTF8ToNSString(application_scheme) copy]); | 23 [base::SysUTF8ToNSString(application_scheme) copy]); |
| 20 DCHECK(application_scheme_); | 24 DCHECK(application_scheme_); |
| 21 } | 25 } |
| 22 } | 26 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 40 RequestTrackerImpl::GetTrackerForRequestGroupID(request_group_id); | 44 RequestTrackerImpl::GetTrackerForRequestGroupID(request_group_id); |
| 41 if (tracker_impl) | 45 if (tracker_impl) |
| 42 *tracker = tracker_impl->GetWeakPtr(); | 46 *tracker = tracker_impl->GetWeakPtr(); |
| 43 // If there is a request group ID, but no associated tracker, return false. | 47 // If there is a request group ID, but no associated tracker, return false. |
| 44 // This usually happens when the tab has been closed, but can maybe also | 48 // This usually happens when the tab has been closed, but can maybe also |
| 45 // happen in other cases (see http://crbug.com/228397). | 49 // happen in other cases (see http://crbug.com/228397). |
| 46 return tracker->get() != nullptr; | 50 return tracker->get() != nullptr; |
| 47 } | 51 } |
| 48 | 52 |
| 49 } // namespace web | 53 } // namespace web |
| OLD | NEW |