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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover.cc

Issue 12500009: Add the ability to clear the shader disk cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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 "chrome/browser/browsing_data/browsing_data_remover.h" 5 #include "chrome/browser/browsing_data/browsing_data_remover.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 waiting_for_clear_history_(false), 141 waiting_for_clear_history_(false),
142 waiting_for_clear_hostname_resolution_cache_(false), 142 waiting_for_clear_hostname_resolution_cache_(false),
143 waiting_for_clear_local_storage_(false), 143 waiting_for_clear_local_storage_(false),
144 waiting_for_clear_nacl_cache_(false), 144 waiting_for_clear_nacl_cache_(false),
145 waiting_for_clear_network_predictor_(false), 145 waiting_for_clear_network_predictor_(false),
146 waiting_for_clear_networking_history_(false), 146 waiting_for_clear_networking_history_(false),
147 waiting_for_clear_plugin_data_(false), 147 waiting_for_clear_plugin_data_(false),
148 waiting_for_clear_quota_managed_data_(false), 148 waiting_for_clear_quota_managed_data_(false),
149 waiting_for_clear_server_bound_certs_(false), 149 waiting_for_clear_server_bound_certs_(false),
150 waiting_for_clear_session_storage_(false), 150 waiting_for_clear_session_storage_(false),
151 waiting_for_clear_shader_cache_(false),
151 remove_mask_(0), 152 remove_mask_(0),
152 remove_origin_(GURL()), 153 remove_origin_(GURL()),
153 origin_set_mask_(0) { 154 origin_set_mask_(0) {
154 DCHECK(profile); 155 DCHECK(profile);
155 // crbug.com/140910: Many places were calling this with base::Time() as 156 // crbug.com/140910: Many places were calling this with base::Time() as
156 // delete_end, even though they should've used base::Time::Max(). Work around 157 // delete_end, even though they should've used base::Time::Max(). Work around
157 // it here. New code should use base::Time::Max(). 158 // it here. New code should use base::Time::Max().
158 DCHECK(delete_end_ != base::Time()); 159 DCHECK(delete_end_ != base::Time());
159 if (delete_end_ == base::Time()) 160 if (delete_end_ == base::Time())
160 delete_end_ = base::Time::Max(); 161 delete_end_ = base::Time::Max();
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 waiting_for_clear_content_licenses_ = true; 500 waiting_for_clear_content_licenses_ = true;
500 if (!pepper_flash_settings_manager_.get()) { 501 if (!pepper_flash_settings_manager_.get()) {
501 pepper_flash_settings_manager_.reset( 502 pepper_flash_settings_manager_.reset(
502 new PepperFlashSettingsManager(this, profile_)); 503 new PepperFlashSettingsManager(this, profile_));
503 } 504 }
504 deauthorize_content_licenses_request_id_ = 505 deauthorize_content_licenses_request_id_ =
505 pepper_flash_settings_manager_->DeauthorizeContentLicenses(); 506 pepper_flash_settings_manager_->DeauthorizeContentLicenses();
506 } 507 }
507 #endif 508 #endif
508 509
510 if (remove_mask & REMOVE_SHADER_CACHE) {
511 waiting_for_clear_shader_cache_ = true;
512 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache"));
513
514 ClearShaderCacheOnUIThread();
515 }
516
509 // Always wipe accumulated network related data (TransportSecurityState and 517 // Always wipe accumulated network related data (TransportSecurityState and
510 // HttpServerPropertiesManager data). 518 // HttpServerPropertiesManager data).
511 waiting_for_clear_networking_history_ = true; 519 waiting_for_clear_networking_history_ = true;
512 profile_->ClearNetworkingHistorySince( 520 profile_->ClearNetworkingHistorySince(
513 delete_begin_, 521 delete_begin_,
514 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, 522 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory,
515 base::Unretained(this))); 523 base::Unretained(this)));
516 } 524 }
517 525
518 void BrowsingDataRemover::AddObserver(Observer* observer) { 526 void BrowsingDataRemover::AddObserver(Observer* observer) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 !waiting_for_clear_history_ && 576 !waiting_for_clear_history_ &&
569 !waiting_for_clear_local_storage_ && 577 !waiting_for_clear_local_storage_ &&
570 !waiting_for_clear_session_storage_ && 578 !waiting_for_clear_session_storage_ &&
571 !waiting_for_clear_networking_history_ && 579 !waiting_for_clear_networking_history_ &&
572 !waiting_for_clear_server_bound_certs_ && 580 !waiting_for_clear_server_bound_certs_ &&
573 !waiting_for_clear_plugin_data_ && 581 !waiting_for_clear_plugin_data_ &&
574 !waiting_for_clear_quota_managed_data_ && 582 !waiting_for_clear_quota_managed_data_ &&
575 !waiting_for_clear_content_licenses_ && 583 !waiting_for_clear_content_licenses_ &&
576 !waiting_for_clear_form_ && 584 !waiting_for_clear_form_ &&
577 !waiting_for_clear_hostname_resolution_cache_ && 585 !waiting_for_clear_hostname_resolution_cache_ &&
578 !waiting_for_clear_network_predictor_; 586 !waiting_for_clear_network_predictor_ &&
587 !waiting_for_clear_shader_cache_;
579 } 588 }
580 589
581 void BrowsingDataRemover::Observe(int type, 590 void BrowsingDataRemover::Observe(int type,
582 const content::NotificationSource& source, 591 const content::NotificationSource& source,
583 const content::NotificationDetails& details) { 592 const content::NotificationDetails& details) {
584 // TODO(brettw) bug 1139736: This should also observe session 593 // TODO(brettw) bug 1139736: This should also observe session
585 // clearing (what about other things such as passwords, etc.?) and wait for 594 // clearing (what about other things such as passwords, etc.?) and wait for
586 // them to complete before continuing. 595 // them to complete before continuing.
587 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); 596 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED);
588 TemplateURLService* model = content::Source<TemplateURLService>(source).ptr(); 597 TemplateURLService* model = content::Source<TemplateURLService>(source).ptr();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 } 770 }
762 default: { 771 default: {
763 NOTREACHED() << "bad state"; 772 NOTREACHED() << "bad state";
764 next_cache_state_ = STATE_NONE; // Stop looping. 773 next_cache_state_ = STATE_NONE; // Stop looping.
765 break; 774 break;
766 } 775 }
767 } 776 }
768 } 777 }
769 } 778 }
770 779
780 void BrowsingDataRemover::ClearedShaderCache() {
781 // This function should be called on the UI thread.
782 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
783
784 waiting_for_clear_shader_cache_ = false;
785 NotifyAndDeleteIfDone();
786 }
787
788 void BrowsingDataRemover::ClearShaderCacheOnUIThread() {
789 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
790
791 BrowserContext::GetDefaultStoragePartition(profile_)->AsyncClearDataBetween(
792 content::StoragePartition::kShaderStorage, delete_begin_, delete_end_,
793 base::Bind(&BrowsingDataRemover::ClearedShaderCache,
794 base::Unretained(this)));
795 }
796
771 #if !defined(DISABLE_NACL) 797 #if !defined(DISABLE_NACL)
772 void BrowsingDataRemover::ClearedNaClCache() { 798 void BrowsingDataRemover::ClearedNaClCache() {
773 // This function should be called on the UI thread. 799 // This function should be called on the UI thread.
774 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 800 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
775 801
776 waiting_for_clear_nacl_cache_ = false; 802 waiting_for_clear_nacl_cache_ = false;
777 803
778 NotifyAndDeleteIfDone(); 804 NotifyAndDeleteIfDone();
779 } 805 }
780 806
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 BrowserThread::UI, FROM_HERE, 1049 BrowserThread::UI, FROM_HERE,
1024 base::Bind(&BrowsingDataRemover::OnClearedFormData, 1050 base::Bind(&BrowsingDataRemover::OnClearedFormData,
1025 base::Unretained(this))); 1051 base::Unretained(this)));
1026 } 1052 }
1027 1053
1028 void BrowsingDataRemover::OnClearedFormData() { 1054 void BrowsingDataRemover::OnClearedFormData() {
1029 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1055 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1030 waiting_for_clear_form_ = false; 1056 waiting_for_clear_form_ = false;
1031 NotifyAndDeleteIfDone(); 1057 NotifyAndDeleteIfDone();
1032 } 1058 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698