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

Side by Side Diff: chrome/browser/browsing_data_local_storage_helper.cc

Issue 8879013: Deprecate WEBKIT thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update after rebase Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/browsing_data_local_storage_helper.h" 5 #include "chrome/browser/browsing_data_local_storage_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 void BrowsingDataLocalStorageHelper::StartFetching( 59 void BrowsingDataLocalStorageHelper::StartFetching(
60 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) { 60 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) {
61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
62 DCHECK(!is_fetching_); 62 DCHECK(!is_fetching_);
63 DCHECK_EQ(false, callback.is_null()); 63 DCHECK_EQ(false, callback.is_null());
64 64
65 is_fetching_ = true; 65 is_fetching_ = true;
66 completion_callback_ = callback; 66 completion_callback_ = callback;
67 BrowserThread::PostTask( 67 BrowserThread::PostTask(
68 BrowserThread::WEBKIT, FROM_HERE, 68 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
69 base::Bind( 69 base::Bind(
70 &BrowsingDataLocalStorageHelper::FetchLocalStorageInfoInWebKitThread, 70 &BrowsingDataLocalStorageHelper::FetchLocalStorageInfoInWebKitThread,
71 this)); 71 this));
72 } 72 }
73 73
74 void BrowsingDataLocalStorageHelper::CancelNotification() { 74 void BrowsingDataLocalStorageHelper::CancelNotification() {
75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
76 completion_callback_.Reset(); 76 completion_callback_.Reset();
77 } 77 }
78 78
79 void BrowsingDataLocalStorageHelper::DeleteLocalStorageFile( 79 void BrowsingDataLocalStorageHelper::DeleteLocalStorageFile(
80 const FilePath& file_path) { 80 const FilePath& file_path) {
81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
82 BrowserThread::PostTask( 82 BrowserThread::PostTask(
83 BrowserThread::WEBKIT, FROM_HERE, 83 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
84 base::Bind( 84 base::Bind(
85 &BrowsingDataLocalStorageHelper::DeleteLocalStorageFileInWebKitThread, 85 &BrowsingDataLocalStorageHelper::DeleteLocalStorageFileInWebKitThread,
86 this, file_path)); 86 this, file_path));
87 } 87 }
88 88
89 void BrowsingDataLocalStorageHelper::FetchLocalStorageInfoInWebKitThread() { 89 void BrowsingDataLocalStorageHelper::FetchLocalStorageInfoInWebKitThread() {
90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
91 file_util::FileEnumerator file_enumerator( 91 file_util::FileEnumerator file_enumerator(
92 profile_->GetWebKitContext()->data_path().Append( 92 profile_->GetWebKitContext()->data_path().Append(
93 DOMStorageContext::kLocalStorageDirectory), 93 DOMStorageContext::kLocalStorageDirectory),
94 false, file_util::FileEnumerator::FILES); 94 false, file_util::FileEnumerator::FILES);
95 for (FilePath file_path = file_enumerator.Next(); !file_path.empty(); 95 for (FilePath file_path = file_enumerator.Next(); !file_path.empty();
96 file_path = file_enumerator.Next()) { 96 file_path = file_enumerator.Next()) {
97 if (file_path.Extension() == DOMStorageContext::kLocalStorageExtension) { 97 if (file_path.Extension() == DOMStorageContext::kLocalStorageExtension) {
98 WebSecurityOrigin web_security_origin = 98 WebSecurityOrigin web_security_origin =
99 WebSecurityOrigin::createFromDatabaseIdentifier( 99 WebSecurityOrigin::createFromDatabaseIdentifier(
100 webkit_glue::FilePathToWebString(file_path.BaseName())); 100 webkit_glue::FilePathToWebString(file_path.BaseName()));
(...skipping 30 matching lines...) Expand all
131 // test it here. 131 // test it here.
132 if (!completion_callback_.is_null()) { 132 if (!completion_callback_.is_null()) {
133 completion_callback_.Run(local_storage_info_); 133 completion_callback_.Run(local_storage_info_);
134 completion_callback_.Reset(); 134 completion_callback_.Reset();
135 } 135 }
136 is_fetching_ = false; 136 is_fetching_ = false;
137 } 137 }
138 138
139 void BrowsingDataLocalStorageHelper::DeleteLocalStorageFileInWebKitThread( 139 void BrowsingDataLocalStorageHelper::DeleteLocalStorageFileInWebKitThread(
140 const FilePath& file_path) { 140 const FilePath& file_path) {
141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); 141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
142 profile_->GetWebKitContext()->dom_storage_context()->DeleteLocalStorageFile( 142 profile_->GetWebKitContext()->dom_storage_context()->DeleteLocalStorageFile(
143 file_path); 143 file_path);
144 } 144 }
145 145
146 CannedBrowsingDataLocalStorageHelper::CannedBrowsingDataLocalStorageHelper( 146 CannedBrowsingDataLocalStorageHelper::CannedBrowsingDataLocalStorageHelper(
147 Profile* profile) 147 Profile* profile)
148 : BrowsingDataLocalStorageHelper(profile), 148 : BrowsingDataLocalStorageHelper(profile),
149 profile_(profile) { 149 profile_(profile) {
150 } 150 }
151 151
(...skipping 28 matching lines...) Expand all
180 180
181 void CannedBrowsingDataLocalStorageHelper::StartFetching( 181 void CannedBrowsingDataLocalStorageHelper::StartFetching(
182 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) { 182 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) {
183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
184 DCHECK(!is_fetching_); 184 DCHECK(!is_fetching_);
185 DCHECK_EQ(false, callback.is_null()); 185 DCHECK_EQ(false, callback.is_null());
186 186
187 is_fetching_ = true; 187 is_fetching_ = true;
188 completion_callback_ = callback; 188 completion_callback_ = callback;
189 BrowserThread::PostTask( 189 BrowserThread::PostTask(
190 BrowserThread::WEBKIT, FROM_HERE, 190 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
191 base::Bind(&CannedBrowsingDataLocalStorageHelper:: 191 base::Bind(&CannedBrowsingDataLocalStorageHelper::
192 ConvertPendingInfoInWebKitThread, this)); 192 ConvertPendingInfoInWebKitThread, this));
193 } 193 }
194 194
195 CannedBrowsingDataLocalStorageHelper::~CannedBrowsingDataLocalStorageHelper() {} 195 CannedBrowsingDataLocalStorageHelper::~CannedBrowsingDataLocalStorageHelper() {}
196 196
197 void CannedBrowsingDataLocalStorageHelper::ConvertPendingInfoInWebKitThread() { 197 void CannedBrowsingDataLocalStorageHelper::ConvertPendingInfoInWebKitThread() {
198 base::AutoLock auto_lock(lock_); 198 base::AutoLock auto_lock(lock_);
199 for (std::set<GURL>::iterator info = pending_local_storage_info_.begin(); 199 for (std::set<GURL>::iterator info = pending_local_storage_info_.begin();
200 info != pending_local_storage_info_.end(); ++info) { 200 info != pending_local_storage_info_.end(); ++info) {
(...skipping 25 matching lines...) Expand all
226 0, 226 0,
227 base::Time())); 227 base::Time()));
228 } 228 }
229 pending_local_storage_info_.clear(); 229 pending_local_storage_info_.clear();
230 230
231 BrowserThread::PostTask( 231 BrowserThread::PostTask(
232 BrowserThread::UI, FROM_HERE, 232 BrowserThread::UI, FROM_HERE,
233 base::Bind(&CannedBrowsingDataLocalStorageHelper::NotifyInUIThread, 233 base::Bind(&CannedBrowsingDataLocalStorageHelper::NotifyInUIThread,
234 this)); 234 this));
235 } 235 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_indexed_db_helper.cc ('k') | chrome/browser/browsing_data_local_storage_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698