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

Side by Side Diff: content/browser/appcache/appcache_storage_impl.cc

Issue 478053003: Remove implicit conversions from scoped_refptr to T* in content/browser/appcache/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 (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 #include "content/browser/appcache/appcache_storage_impl.h" 5 #include "content/browser/appcache/appcache_storage_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 AppCacheDatabase* database, 75 AppCacheDatabase* database,
76 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy, 76 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy,
77 bool force_keep_session_state) { 77 bool force_keep_session_state) {
78 scoped_ptr<AppCacheDatabase> database_to_delete(database); 78 scoped_ptr<AppCacheDatabase> database_to_delete(database);
79 79
80 // If saving session state, only delete the database. 80 // If saving session state, only delete the database.
81 if (force_keep_session_state) 81 if (force_keep_session_state)
82 return; 82 return;
83 83
84 bool has_session_only_appcaches = 84 bool has_session_only_appcaches =
85 special_storage_policy && 85 special_storage_policy.get() &&
86 special_storage_policy->HasSessionOnlyOrigins(); 86 special_storage_policy->HasSessionOnlyOrigins();
87 87
88 // Clearning only session-only databases, and there are none. 88 // Clearning only session-only databases, and there are none.
89 if (!has_session_only_appcaches) 89 if (!has_session_only_appcaches)
90 return; 90 return;
91 91
92 std::set<GURL> origins; 92 std::set<GURL> origins;
93 database->FindOriginsWithGroups(&origins); 93 database->FindOriginsWithGroups(&origins);
94 if (origins.empty()) 94 if (origins.empty())
95 return; // nothing to delete 95 return; // nothing to delete
96 96
97 sql::Connection* connection = database->db_connection(); 97 sql::Connection* connection = database->db_connection();
98 if (!connection) { 98 if (!connection) {
99 NOTREACHED() << "Missing database connection."; 99 NOTREACHED() << "Missing database connection.";
100 return; 100 return;
101 } 101 }
102 102
103 std::set<GURL>::const_iterator origin; 103 std::set<GURL>::const_iterator origin;
104 DCHECK(special_storage_policy); 104 DCHECK(special_storage_policy.get());
105 for (origin = origins.begin(); origin != origins.end(); ++origin) { 105 for (origin = origins.begin(); origin != origins.end(); ++origin) {
106 if (!special_storage_policy->IsStorageSessionOnly(*origin)) 106 if (!special_storage_policy->IsStorageSessionOnly(*origin))
107 continue; 107 continue;
108 if (special_storage_policy->IsStorageProtected(*origin)) 108 if (special_storage_policy->IsStorageProtected(*origin))
109 continue; 109 continue;
110 110
111 std::vector<AppCacheDatabase::GroupRecord> groups; 111 std::vector<AppCacheDatabase::GroupRecord> groups;
112 database->FindGroupsForOrigin(*origin, &groups); 112 database->FindGroupsForOrigin(*origin, &groups);
113 std::vector<AppCacheDatabase::GroupRecord>::const_iterator group; 113 std::vector<AppCacheDatabase::GroupRecord>::const_iterator group;
114 for (group = groups.begin(); group != groups.end(); ++group) { 114 for (group = groups.begin(); group != groups.end(); ++group) {
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 service()->force_keep_session_state()))) { 1344 service()->force_keep_session_state()))) {
1345 delete database_; 1345 delete database_;
1346 } 1346 }
1347 database_ = NULL; // So no further database tasks can be scheduled. 1347 database_ = NULL; // So no further database tasks can be scheduled.
1348 } 1348 }
1349 1349
1350 void AppCacheStorageImpl::Initialize( 1350 void AppCacheStorageImpl::Initialize(
1351 const base::FilePath& cache_directory, 1351 const base::FilePath& cache_directory,
1352 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, 1352 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread,
1353 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread) { 1353 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread) {
1354 DCHECK(db_thread); 1354 DCHECK(db_thread.get());
1355 1355
1356 cache_directory_ = cache_directory; 1356 cache_directory_ = cache_directory;
1357 is_incognito_ = cache_directory_.empty(); 1357 is_incognito_ = cache_directory_.empty();
1358 1358
1359 base::FilePath db_file_path; 1359 base::FilePath db_file_path;
1360 if (!is_incognito_) 1360 if (!is_incognito_)
1361 db_file_path = cache_directory_.Append(kAppCacheDatabaseName); 1361 db_file_path = cache_directory_.Append(kAppCacheDatabaseName);
1362 database_ = new AppCacheDatabase(db_file_path); 1362 database_ = new AppCacheDatabase(db_file_path);
1363 1363
1364 db_thread_ = db_thread; 1364 db_thread_ = db_thread;
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 base::Bind(&AppCacheStorageImpl::CallScheduleReinitialize, 1857 base::Bind(&AppCacheStorageImpl::CallScheduleReinitialize,
1858 weak_factory_.GetWeakPtr())); 1858 weak_factory_.GetWeakPtr()));
1859 } 1859 }
1860 1860
1861 void AppCacheStorageImpl::CallScheduleReinitialize() { 1861 void AppCacheStorageImpl::CallScheduleReinitialize() {
1862 service_->ScheduleReinitialize(); 1862 service_->ScheduleReinitialize();
1863 // note: 'this' may be deleted at this point. 1863 // note: 'this' may be deleted at this point.
1864 } 1864 }
1865 1865
1866 } // namespace content 1866 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698