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

Side by Side Diff: storage/browser/fileapi/sandbox_file_stream_writer.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 "storage/browser/fileapi/sandbox_file_stream_writer.h" 5 #include "storage/browser/fileapi/sandbox_file_stream_writer.h"
6 6
7 #include "base/files/file_util_proxy.h" 7 #include "base/files/file_util_proxy.h"
8 #include "base/sequenced_task_runner.h" 8 #include "base/sequenced_task_runner.h"
9 #include "base/trace_event/trace_event.h"
9 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
11 #include "storage/browser/fileapi/file_observers.h" 12 #include "storage/browser/fileapi/file_observers.h"
12 #include "storage/browser/fileapi/file_stream_reader.h" 13 #include "storage/browser/fileapi/file_stream_reader.h"
13 #include "storage/browser/fileapi/file_system_context.h" 14 #include "storage/browser/fileapi/file_system_context.h"
14 #include "storage/browser/fileapi/file_system_operation_runner.h" 15 #include "storage/browser/fileapi/file_system_operation_runner.h"
15 #include "storage/browser/quota/quota_manager_proxy.h" 16 #include "storage/browser/quota/quota_manager_proxy.h"
16 #include "storage/common/fileapi/file_system_util.h" 17 #include "storage/common/fileapi/file_system_util.h"
17 18
18 namespace storage { 19 namespace storage {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 storage::QuotaManagerProxy* quota_manager_proxy = 145 storage::QuotaManagerProxy* quota_manager_proxy =
145 file_system_context_->quota_manager_proxy(); 146 file_system_context_->quota_manager_proxy();
146 if (!quota_manager_proxy) { 147 if (!quota_manager_proxy) {
147 // If we don't have the quota manager or the requested filesystem type 148 // If we don't have the quota manager or the requested filesystem type
148 // does not support quota, we should be able to let it go. 149 // does not support quota, we should be able to let it go.
149 allowed_bytes_to_write_ = default_quota_; 150 allowed_bytes_to_write_ = default_quota_;
150 callback.Run(net::OK); 151 callback.Run(net::OK);
151 return; 152 return;
152 } 153 }
153 154
155 // crbug.com/349708
156 TRACE_EVENT0("io", "SandboxFileStreamWriter::DidCreateSnapshotFile");
157
154 DCHECK(quota_manager_proxy->quota_manager()); 158 DCHECK(quota_manager_proxy->quota_manager());
155 quota_manager_proxy->quota_manager()->GetUsageAndQuota( 159 quota_manager_proxy->quota_manager()->GetUsageAndQuota(
156 url_.origin(), 160 url_.origin(),
157 FileSystemTypeToQuotaStorageType(url_.type()), 161 FileSystemTypeToQuotaStorageType(url_.type()),
158 base::Bind(&SandboxFileStreamWriter::DidGetUsageAndQuota, 162 base::Bind(&SandboxFileStreamWriter::DidGetUsageAndQuota,
159 weak_factory_.GetWeakPtr(), callback)); 163 weak_factory_.GetWeakPtr(), callback));
160 } 164 }
161 165
162 void SandboxFileStreamWriter::DidGetUsageAndQuota( 166 void SandboxFileStreamWriter::DidGetUsageAndQuota(
163 const net::CompletionCallback& callback, 167 const net::CompletionCallback& callback,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 DCHECK(cancel_callback_.is_null()); 241 DCHECK(cancel_callback_.is_null());
238 242
239 // Write() is not called yet, so there's nothing to flush. 243 // Write() is not called yet, so there's nothing to flush.
240 if (!local_file_writer_) 244 if (!local_file_writer_)
241 return net::OK; 245 return net::OK;
242 246
243 return local_file_writer_->Flush(callback); 247 return local_file_writer_->Flush(callback);
244 } 248 }
245 249
246 } // namespace storage 250 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698