diff options
Diffstat (limited to 'storage')
-rw-r--r-- | storage/browser/fileapi/file_system_operation_impl.cc | 32 | ||||
-rw-r--r-- | storage/browser/fileapi/sandbox_file_stream_writer.cc | 11 | ||||
-rw-r--r-- | storage/browser/quota/quota_callbacks.h | 4 | ||||
-rw-r--r-- | storage/browser/quota/quota_manager.cc | 38 | ||||
-rw-r--r-- | storage/browser/quota/quota_manager_proxy.cc | 8 | ||||
-rw-r--r-- | storage/browser/quota/storage_monitor.cc | 20 |
6 files changed, 112 insertions, 1 deletions
diff --git a/storage/browser/fileapi/file_system_operation_impl.cc b/storage/browser/fileapi/file_system_operation_impl.cc index 30d8561..79cf89e 100644 --- a/storage/browser/fileapi/file_system_operation_impl.cc +++ b/storage/browser/fileapi/file_system_operation_impl.cc @@ -8,6 +8,7 @@ #include "base/single_thread_task_runner.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" +#include "base/trace_event/trace_event.h" #include "net/base/escape.h" #include "net/url_request/url_request.h" #include "storage/browser/blob/shareable_file_reference.h" @@ -63,7 +64,11 @@ FileSystemOperationImpl::~FileSystemOperationImpl() { void FileSystemOperationImpl::CreateFile(const FileSystemURL& url, bool exclusive, const StatusCallback& callback) { + // crbug.com/349708 + TRACE_EVENT0("io", "FileSystemOperationImpl::CreateFile"); + DCHECK(SetPendingOperationType(kOperationCreateFile)); + GetUsageAndQuotaThenRunTask( url, base::Bind(&FileSystemOperationImpl::DoCreateFile, @@ -76,6 +81,10 @@ void FileSystemOperationImpl::CreateDirectory(const FileSystemURL& url, bool recursive, const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationCreateDirectory)); + + // crbug.com/349708 + TRACE_EVENT0("io", "FileSystemOperationImpl::CreateDirectory"); + GetUsageAndQuotaThenRunTask( url, base::Bind(&FileSystemOperationImpl::DoCreateDirectory, @@ -190,6 +199,10 @@ void FileSystemOperationImpl::Write( void FileSystemOperationImpl::Truncate(const FileSystemURL& url, int64 length, const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationTruncate)); + + // crbug.com/349708 + TRACE_EVENT0("io", "FileSystemOperationImpl::Truncate"); + GetUsageAndQuotaThenRunTask( url, base::Bind(&FileSystemOperationImpl::DoTruncate, @@ -202,6 +215,10 @@ void FileSystemOperationImpl::TouchFile(const FileSystemURL& url, const base::Time& last_modified_time, const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationTouchFile)); + + // crbug.com/349708 + TRACE_EVENT0("io", "FileSystemOperationImpl::TouchFile"); + async_file_util_->Touch( operation_context_.Pass(), url, last_access_time, last_modified_time, @@ -220,6 +237,10 @@ void FileSystemOperationImpl::OpenFile(const FileSystemURL& url, base::Closure()); return; } + + // crbug.com/349708 + TRACE_EVENT0("io", "FileSystemOperationImpl::OpenFile"); + GetUsageAndQuotaThenRunTask( url, base::Bind(&FileSystemOperationImpl::DoOpenFile, @@ -262,6 +283,10 @@ void FileSystemOperationImpl::CopyInForeignFile( const FileSystemURL& dest_url, const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationCopyInForeignFile)); + + // crbug.com/349708 + TRACE_EVENT0("io", "FileSystemOperationImpl::CopyInForeinFile"); + GetUsageAndQuotaThenRunTask( dest_url, base::Bind(&FileSystemOperationImpl::DoCopyInForeignFile, @@ -299,6 +324,9 @@ void FileSystemOperationImpl::CopyFileLocal( DCHECK(SetPendingOperationType(kOperationCopy)); DCHECK(src_url.IsInSameFileSystem(dest_url)); + // crbug.com/349708 + TRACE_EVENT0("io", "FileSystemOperationImpl::CopyFileLocal"); + GetUsageAndQuotaThenRunTask( dest_url, base::Bind(&FileSystemOperationImpl::DoCopyFileLocal, @@ -314,6 +342,10 @@ void FileSystemOperationImpl::MoveFileLocal( const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationMove)); DCHECK(src_url.IsInSameFileSystem(dest_url)); + + // crbug.com/349708 + TRACE_EVENT0("io", "FileSystemOperationImpl::MoveFileLocal"); + GetUsageAndQuotaThenRunTask( dest_url, base::Bind(&FileSystemOperationImpl::DoMoveFileLocal, diff --git a/storage/browser/fileapi/sandbox_file_stream_writer.cc b/storage/browser/fileapi/sandbox_file_stream_writer.cc index 7474894..d6895c8 100644 --- a/storage/browser/fileapi/sandbox_file_stream_writer.cc +++ b/storage/browser/fileapi/sandbox_file_stream_writer.cc @@ -6,6 +6,7 @@ #include "base/files/file_util_proxy.h" #include "base/sequenced_task_runner.h" +#include "base/trace_event/trace_event.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "storage/browser/fileapi/file_observers.h" @@ -151,6 +152,9 @@ void SandboxFileStreamWriter::DidCreateSnapshotFile( return; } + // crbug.com/349708 + TRACE_EVENT0("io", "SandboxFileStreamWriter::DidCreateSnapshotFile"); + DCHECK(quota_manager_proxy->quota_manager()); quota_manager_proxy->quota_manager()->GetUsageAndQuota( url_.origin(), @@ -168,10 +172,17 @@ void SandboxFileStreamWriter::DidGetUsageAndQuota( return; if (status != storage::kQuotaStatusOk) { LOG(WARNING) << "Got unexpected quota error : " << status; + + // crbug.com/349708 + TRACE_EVENT0("io", "SandboxFileStreamWriter::DidGetUsageAndQuota FAILED"); + callback.Run(net::ERR_FAILED); return; } + // crbug.com/349708 + TRACE_EVENT0("io", "SandboxFileStreamWriter::DidGetUsageAndQuota OK"); + allowed_bytes_to_write_ = quota - usage; callback.Run(net::OK); } diff --git a/storage/browser/quota/quota_callbacks.h b/storage/browser/quota/quota_callbacks.h index 36bca1e..4746c5e 100644 --- a/storage/browser/quota/quota_callbacks.h +++ b/storage/browser/quota/quota_callbacks.h @@ -60,6 +60,10 @@ class CallbackQueue { callbacks_.swap(other->callbacks_); } + size_t size() const { + return callbacks_.size(); + } + private: std::vector<CallbackType> callbacks_; }; diff --git a/storage/browser/quota/quota_manager.cc b/storage/browser/quota/quota_manager.cc index 52f7280..674b1ec 100644 --- a/storage/browser/quota/quota_manager.cc +++ b/storage/browser/quota/quota_manager.cc @@ -19,6 +19,7 @@ #include "base/sys_info.h" #include "base/task_runner_util.h" #include "base/time/time.h" +#include "base/trace_event/trace_event.h" #include "net/base/net_util.h" #include "storage/browser/quota/client_usage_tracker.h" #include "storage/browser/quota/quota_manager_proxy.h" @@ -188,6 +189,9 @@ bool UpdateModifiedTimeOnDBThread(const GURL& origin, } int64 CallSystemGetAmountOfFreeDiskSpace(const base::FilePath& profile_path) { + // crbug.com/349708 + TRACE_EVENT0("io", "CallSystemGetAmountOfFreeDiskSpace"); + // Ensure the profile path exists. if (!base::CreateDirectory(profile_path)) { LOG(WARNING) << "Create directory failed for path" << profile_path.value(); @@ -410,6 +414,10 @@ class UsageAndQuotaCallbackDispatcher } void DidGetAvailableSpace(QuotaStatusCode status, int64 space) { + // crbug.com/349708 + TRACE_EVENT0( + "io", "UsageAndQuotaCallbackDispatcher::DidGetAvailableSpace"); + DCHECK_GE(space, 0); if (status_ == kQuotaStatusUnknown || status_ == kQuotaStatusOk) status_ = status; @@ -430,6 +438,9 @@ class UsageAndQuotaCallbackDispatcher } void Completed() override { + // crbug.com/349708 + TRACE_EVENT0("io", "UsageAndQuotaCallbackDispatcher::Completed"); + DCHECK(!has_usage_ || usage_and_quota_.usage >= 0); DCHECK(!has_global_limited_usage_ || usage_and_quota_.global_limited_usage >= 0); @@ -472,6 +483,9 @@ class QuotaManager::GetUsageInfoTask : public QuotaTask { protected: void Run() override { + // crbug.com/349708 + TRACE_EVENT0("io", "QuotaManager::GetUsageInfoTask::Run"); + remaining_trackers_ = 3; // This will populate cached hosts and usage info. manager()->GetUsageTracker(kStorageTypeTemporary)->GetGlobalUsage( @@ -489,6 +503,9 @@ class QuotaManager::GetUsageInfoTask : public QuotaTask { } void Completed() override { + // crbug.com/349708 + TRACE_EVENT0("io", "QuotaManager::GetUsageInfoTask::Completed"); + callback_.Run(entries_); DeleteSoon(); } @@ -566,11 +583,17 @@ class QuotaManager::OriginDataDeleter : public QuotaTask { void Completed() override { if (error_count_ == 0) { + // crbug.com/349708 + TRACE_EVENT0("io", "QuotaManager::OriginDataDeleter::Completed Ok"); + // Only remove the entire origin if we didn't skip any client types. if (skipped_clients_ == 0) manager()->DeleteOriginFromDatabase(origin_, type_); callback_.Run(kQuotaStatusOk); } else { + // crbug.com/349708 + TRACE_EVENT0("io", "QuotaManager::OriginDataDeleter::Completed Error"); + callback_.Run(kQuotaErrorInvalidModification); } DeleteSoon(); @@ -640,8 +663,14 @@ class QuotaManager::HostDataDeleter : public QuotaTask { void Completed() override { if (error_count_ == 0) { + // crbug.com/349708 + TRACE_EVENT0("io", "QuotaManager::HostDataDeleter::Completed Ok"); + callback_.Run(kQuotaStatusOk); } else { + // crbug.com/349708 + TRACE_EVENT0("io", "QuotaManager::HostDataDeleter::Completed Error"); + callback_.Run(kQuotaErrorInvalidModification); } DeleteSoon(); @@ -960,6 +989,8 @@ void QuotaManager::DeleteHostData(const std::string& host, void QuotaManager::GetAvailableSpace(const AvailableSpaceCallback& callback) { if (!available_space_callbacks_.Add(callback)) return; + // crbug.com/349708 + TRACE_EVENT0("io", "QuotaManager::GetAvailableSpace"); PostTaskAndReplyWithResult(db_thread_.get(), FROM_HERE, @@ -1462,6 +1493,9 @@ void QuotaManager::EvictOriginData(const GURL& origin, void QuotaManager::GetUsageAndQuotaForEviction( const UsageAndQuotaCallback& callback) { + // crbug.com/349708 + TRACE_EVENT0("io", "QuotaManager::GetUsageAndQuotaForEviction"); + DCHECK(io_thread_->BelongsToCurrentThread()); LazyInitialize(); @@ -1602,6 +1636,10 @@ void QuotaManager::DidInitializeTemporaryOriginsInfo(bool success) { } void QuotaManager::DidGetAvailableSpace(int64 space) { + // crbug.com/349708 + TRACE_EVENT1("io", "QuotaManager::DidGetAvailableSpace", + "n_callbacks", available_space_callbacks_.size()); + available_space_callbacks_.Run(kQuotaStatusOk, space); } diff --git a/storage/browser/quota/quota_manager_proxy.cc b/storage/browser/quota/quota_manager_proxy.cc index c8ccefc..921eab2 100644 --- a/storage/browser/quota/quota_manager_proxy.cc +++ b/storage/browser/quota/quota_manager_proxy.cc @@ -10,6 +10,7 @@ #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" #include "base/task_runner_util.h" +#include "base/trace_event/trace_event.h" namespace storage { @@ -27,6 +28,9 @@ void DidGetUsageAndQuota( callback, status, usage, quota)); return; } + + // crbug.com/349708 + TRACE_EVENT0("io", "QuotaManagerProxy DidGetUsageAndQuota"); callback.Run(status, usage, quota); } @@ -137,6 +141,10 @@ void QuotaManagerProxy::GetUsageAndQuota( DidGetUsageAndQuota(original_task_runner, callback, kQuotaErrorAbort, 0, 0); return; } + + // crbug.com/349708 + TRACE_EVENT0("io", "QuotaManagerProxy::GetUsageAndQuota"); + manager_->GetUsageAndQuota( origin, type, base::Bind(&DidGetUsageAndQuota, diff --git a/storage/browser/quota/storage_monitor.cc b/storage/browser/quota/storage_monitor.cc index f312bd3..2ce2122 100644 --- a/storage/browser/quota/storage_monitor.cc +++ b/storage/browser/quota/storage_monitor.cc @@ -7,6 +7,7 @@ #include <algorithm> #include "base/stl_util.h" +#include "base/trace_event/trace_event.h" #include "net/base/net_util.h" #include "storage/browser/quota/quota_manager.h" #include "storage/common/quota/quota_status_code.h" @@ -39,6 +40,10 @@ int StorageObserverList::ObserverCount() const { } void StorageObserverList::OnStorageChange(const StorageObserver::Event& event) { + // crbug.com/349708 + TRACE_EVENT0("io", + "HostStorageObserversStorageObserverList::OnStorageChange"); + for (StorageObserverStateMap::iterator it = observers_.begin(); it != observers_.end(); ++it) { it->second.requires_update = true; @@ -49,6 +54,9 @@ void StorageObserverList::OnStorageChange(const StorageObserver::Event& event) { void StorageObserverList::MaybeDispatchEvent( const StorageObserver::Event& event) { + // crbug.com/349708 + TRACE_EVENT0("io", "StorageObserverList::MaybeDispatchEvent"); + notification_timer_.Stop(); base::TimeDelta min_delay = base::TimeDelta::Max(); bool all_observers_notified = true; @@ -66,6 +74,10 @@ void StorageObserverList::MaybeDispatchEvent( it->second.last_notification_time = current_time; if (it->second.origin == event.filter.origin) { + // crbug.com/349708 + TRACE_EVENT0("io", + "StorageObserverList::MaybeDispatchEvent OnStorageEvent1"); + it->first->OnStorageEvent(event); } else { // When the quota and usage of an origin is requested, QuotaManager @@ -75,6 +87,11 @@ void StorageObserverList::MaybeDispatchEvent( // registered. StorageObserver::Event dispatch_event(event); dispatch_event.filter.origin = it->second.origin; + + // crbug.com/349708 + TRACE_EVENT0("io", + "StorageObserverList::MaybeDispatchEvent OnStorageEvent2"); + it->first->OnStorageEvent(dispatch_event); } } else { @@ -183,6 +200,8 @@ void HostStorageObservers::StartInitialization( const StorageObserver::Filter& filter) { if (initialized_ || initializing_) return; + // crbug.com/349708 + TRACE_EVENT0("io", "HostStorageObservers::StartInitialization"); initializing_ = true; quota_manager_->GetUsageAndQuotaForWebApps( @@ -201,7 +220,6 @@ void HostStorageObservers::GotHostUsageAndQuota( initializing_ = false; if (status != kQuotaStatusOk) return; - initialized_ = true; cached_quota_ = quota; cached_usage_ = usage + usage_deltas_during_init_; |