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

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

Issue 1394563002: Add trace to the caller of QuotaManager::GetAvailableSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/profiler/scoped_tracker.h" 17 #include "base/profiler/scoped_tracker.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/stl_util.h" 19 #include "base/stl_util.h"
20 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
21 #include "base/thread_task_runner_handle.h" 21 #include "base/thread_task_runner_handle.h"
22 #include "base/trace_event/trace_event.h"
22 #include "content/browser/appcache/appcache.h" 23 #include "content/browser/appcache/appcache.h"
23 #include "content/browser/appcache/appcache_database.h" 24 #include "content/browser/appcache/appcache_database.h"
24 #include "content/browser/appcache/appcache_entry.h" 25 #include "content/browser/appcache/appcache_entry.h"
25 #include "content/browser/appcache/appcache_group.h" 26 #include "content/browser/appcache/appcache_group.h"
26 #include "content/browser/appcache/appcache_histograms.h" 27 #include "content/browser/appcache/appcache_histograms.h"
27 #include "content/browser/appcache/appcache_quota_client.h" 28 #include "content/browser/appcache/appcache_quota_client.h"
28 #include "content/browser/appcache/appcache_response.h" 29 #include "content/browser/appcache/appcache_response.h"
29 #include "content/browser/appcache/appcache_service_impl.h" 30 #include "content/browser/appcache/appcache_service_impl.h"
30 #include "net/base/cache_type.h" 31 #include "net/base/cache_type.h"
31 #include "net/base/net_errors.h" 32 #include "net/base/net_errors.h"
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 658
658 if (!quota_manager) { 659 if (!quota_manager) {
659 if (storage_->service()->special_storage_policy() && 660 if (storage_->service()->special_storage_policy() &&
660 storage_->service()->special_storage_policy()->IsStorageUnlimited( 661 storage_->service()->special_storage_policy()->IsStorageUnlimited(
661 group_record_.origin)) 662 group_record_.origin))
662 space_available_ = kint64max; 663 space_available_ = kint64max;
663 Schedule(); 664 Schedule();
664 return; 665 return;
665 } 666 }
666 667
668 // crbug.com/349708
669 TRACE_EVENT0(
670 "io",
671 "AppCacheStorageImpl::StoreGroupAndCacheTask::GetQuotaThenSchedule");
672
667 // We have to ask the quota manager for the value. 673 // We have to ask the quota manager for the value.
668 storage_->pending_quota_queries_.insert(this); 674 storage_->pending_quota_queries_.insert(this);
669 quota_manager->GetUsageAndQuota( 675 quota_manager->GetUsageAndQuota(
670 group_record_.origin, 676 group_record_.origin,
671 storage::kStorageTypeTemporary, 677 storage::kStorageTypeTemporary,
672 base::Bind(&StoreGroupAndCacheTask::OnQuotaCallback, this)); 678 base::Bind(&StoreGroupAndCacheTask::OnQuotaCallback, this));
673 } 679 }
674 680
675 void AppCacheStorageImpl::StoreGroupAndCacheTask::OnQuotaCallback( 681 void AppCacheStorageImpl::StoreGroupAndCacheTask::OnQuotaCallback(
michaeln 2015/10/09 00:51:42 If i understand the trace properly, the time is be
oshima 2015/10/09 17:14:09 That's the theory. I was adding the caller side as
676 storage::QuotaStatusCode status, 682 storage::QuotaStatusCode status,
677 int64 usage, 683 int64 usage,
678 int64 quota) { 684 int64 quota) {
679 if (storage_) { 685 if (storage_) {
680 if (status == storage::kQuotaStatusOk) 686 if (status == storage::kQuotaStatusOk)
681 space_available_ = std::max(static_cast<int64>(0), quota - usage); 687 space_available_ = std::max(static_cast<int64>(0), quota - usage);
682 else 688 else
683 space_available_ = 0; 689 space_available_ = 0;
684 storage_->pending_quota_queries_.erase(this); 690 storage_->pending_quota_queries_.erase(this);
685 Schedule(); 691 Schedule();
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 1979
1974 void AppCacheStorageImpl::OnLazyCommitTimer() { 1980 void AppCacheStorageImpl::OnLazyCommitTimer() {
1975 lazy_commit_timer_.Stop(); 1981 lazy_commit_timer_.Stop();
1976 if (is_disabled()) 1982 if (is_disabled())
1977 return; 1983 return;
1978 scoped_refptr<DatabaseTask> task(new CommitLastAccessTimesTask(this)); 1984 scoped_refptr<DatabaseTask> task(new CommitLastAccessTimesTask(this));
1979 task->Schedule(); 1985 task->Schedule();
1980 } 1986 }
1981 1987
1982 } // namespace content 1988 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698