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

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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 waiting_for_clear_history_(false), 140 waiting_for_clear_history_(false),
141 waiting_for_clear_hostname_resolution_cache_(false), 141 waiting_for_clear_hostname_resolution_cache_(false),
142 waiting_for_clear_local_storage_(false), 142 waiting_for_clear_local_storage_(false),
143 waiting_for_clear_nacl_cache_(false), 143 waiting_for_clear_nacl_cache_(false),
144 waiting_for_clear_network_predictor_(false), 144 waiting_for_clear_network_predictor_(false),
145 waiting_for_clear_networking_history_(false), 145 waiting_for_clear_networking_history_(false),
146 waiting_for_clear_plugin_data_(false), 146 waiting_for_clear_plugin_data_(false),
147 waiting_for_clear_quota_managed_data_(false), 147 waiting_for_clear_quota_managed_data_(false),
148 waiting_for_clear_server_bound_certs_(false), 148 waiting_for_clear_server_bound_certs_(false),
149 waiting_for_clear_session_storage_(false), 149 waiting_for_clear_session_storage_(false),
150 waiting_for_clear_shader_cache_(false),
150 remove_mask_(0), 151 remove_mask_(0),
151 remove_origin_(GURL()), 152 remove_origin_(GURL()),
152 origin_set_mask_(0) { 153 origin_set_mask_(0) {
153 DCHECK(profile); 154 DCHECK(profile);
154 // crbug.com/140910: Many places were calling this with base::Time() as 155 // crbug.com/140910: Many places were calling this with base::Time() as
155 // delete_end, even though they should've used base::Time::Max(). Work around 156 // delete_end, even though they should've used base::Time::Max(). Work around
156 // it here. New code should use base::Time::Max(). 157 // it here. New code should use base::Time::Max().
157 DCHECK(delete_end_ != base::Time()); 158 DCHECK(delete_end_ != base::Time());
158 if (delete_end_ == base::Time()) 159 if (delete_end_ == base::Time())
159 delete_end_ = base::Time::Max(); 160 delete_end_ = base::Time::Max();
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 waiting_for_clear_content_licenses_ = true; 499 waiting_for_clear_content_licenses_ = true;
499 if (!pepper_flash_settings_manager_.get()) { 500 if (!pepper_flash_settings_manager_.get()) {
500 pepper_flash_settings_manager_.reset( 501 pepper_flash_settings_manager_.reset(
501 new PepperFlashSettingsManager(this, profile_)); 502 new PepperFlashSettingsManager(this, profile_));
502 } 503 }
503 deauthorize_content_licenses_request_id_ = 504 deauthorize_content_licenses_request_id_ =
504 pepper_flash_settings_manager_->DeauthorizeContentLicenses(); 505 pepper_flash_settings_manager_->DeauthorizeContentLicenses();
505 } 506 }
506 #endif 507 #endif
507 508
509 if (remove_mask & REMOVE_SHADER_CACHE) {
510 waiting_for_clear_shader_cache_ = true;
511 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache"));
512
513 ClearShaderCacheOnUIThread();
514 }
515
508 // Always wipe accumulated network related data (TransportSecurityState and 516 // Always wipe accumulated network related data (TransportSecurityState and
509 // HttpServerPropertiesManager data). 517 // HttpServerPropertiesManager data).
510 waiting_for_clear_networking_history_ = true; 518 waiting_for_clear_networking_history_ = true;
511 profile_->ClearNetworkingHistorySince( 519 profile_->ClearNetworkingHistorySince(
512 delete_begin_, 520 delete_begin_,
513 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory, 521 base::Bind(&BrowsingDataRemover::OnClearedNetworkingHistory,
514 base::Unretained(this))); 522 base::Unretained(this)));
515 } 523 }
516 524
517 void BrowsingDataRemover::AddObserver(Observer* observer) { 525 void BrowsingDataRemover::AddObserver(Observer* observer) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 !waiting_for_clear_history_ && 575 !waiting_for_clear_history_ &&
568 !waiting_for_clear_local_storage_ && 576 !waiting_for_clear_local_storage_ &&
569 !waiting_for_clear_session_storage_ && 577 !waiting_for_clear_session_storage_ &&
570 !waiting_for_clear_networking_history_ && 578 !waiting_for_clear_networking_history_ &&
571 !waiting_for_clear_server_bound_certs_ && 579 !waiting_for_clear_server_bound_certs_ &&
572 !waiting_for_clear_plugin_data_ && 580 !waiting_for_clear_plugin_data_ &&
573 !waiting_for_clear_quota_managed_data_ && 581 !waiting_for_clear_quota_managed_data_ &&
574 !waiting_for_clear_content_licenses_ && 582 !waiting_for_clear_content_licenses_ &&
575 !waiting_for_clear_form_ && 583 !waiting_for_clear_form_ &&
576 !waiting_for_clear_hostname_resolution_cache_ && 584 !waiting_for_clear_hostname_resolution_cache_ &&
577 !waiting_for_clear_network_predictor_; 585 !waiting_for_clear_network_predictor_ &&
586 !waiting_for_clear_shader_cache_;
578 } 587 }
579 588
580 void BrowsingDataRemover::Observe(int type, 589 void BrowsingDataRemover::Observe(int type,
581 const content::NotificationSource& source, 590 const content::NotificationSource& source,
582 const content::NotificationDetails& details) { 591 const content::NotificationDetails& details) {
583 // TODO(brettw) bug 1139736: This should also observe session 592 // TODO(brettw) bug 1139736: This should also observe session
584 // clearing (what about other things such as passwords, etc.?) and wait for 593 // clearing (what about other things such as passwords, etc.?) and wait for
585 // them to complete before continuing. 594 // them to complete before continuing.
586 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); 595 DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED);
587 TemplateURLService* model = content::Source<TemplateURLService>(source).ptr(); 596 TemplateURLService* model = content::Source<TemplateURLService>(source).ptr();
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 } 747 }
739 default: { 748 default: {
740 NOTREACHED() << "bad state"; 749 NOTREACHED() << "bad state";
741 next_cache_state_ = STATE_NONE; // Stop looping. 750 next_cache_state_ = STATE_NONE; // Stop looping.
742 return; 751 return;
743 } 752 }
744 } 753 }
745 } 754 }
746 } 755 }
747 756
757 void BrowsingDataRemover::ClearedShaderCache() {
758 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
759
760 waiting_for_clear_shader_cache_ = false;
761 NotifyAndDeleteIfDone();
762 }
763
764 void BrowsingDataRemover::ClearShaderCacheOnUIThread() {
765 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
766
767 BrowserContext::GetDefaultStoragePartition(profile_)->AsyncClearDataBetween(
768 content::StoragePartition::kShaderStorage, delete_begin_, delete_end_,
769 base::Bind(&BrowsingDataRemover::ClearedShaderCache,
770 base::Unretained(this)));
771 }
772
748 #if !defined(DISABLE_NACL) 773 #if !defined(DISABLE_NACL)
749 void BrowsingDataRemover::ClearedNaClCache() { 774 void BrowsingDataRemover::ClearedNaClCache() {
750 // This function should be called on the UI thread. 775 // This function should be called on the UI thread.
751 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 776 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
752 777
753 waiting_for_clear_nacl_cache_ = false; 778 waiting_for_clear_nacl_cache_ = false;
754 779
755 NotifyAndDeleteIfDone(); 780 NotifyAndDeleteIfDone();
756 } 781 }
757 782
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 BrowserThread::UI, FROM_HERE, 1025 BrowserThread::UI, FROM_HERE,
1001 base::Bind(&BrowsingDataRemover::OnClearedFormData, 1026 base::Bind(&BrowsingDataRemover::OnClearedFormData,
1002 base::Unretained(this))); 1027 base::Unretained(this)));
1003 } 1028 }
1004 1029
1005 void BrowsingDataRemover::OnClearedFormData() { 1030 void BrowsingDataRemover::OnClearedFormData() {
1006 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1031 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1007 waiting_for_clear_form_ = false; 1032 waiting_for_clear_form_ = false;
1008 NotifyAndDeleteIfDone(); 1033 NotifyAndDeleteIfDone();
1009 } 1034 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.h ('k') | chrome/browser/ui/webui/options/clear_browser_data_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698