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

Unified Diff: content/browser/fileapi/fileapi_message_filter.cc

Issue 1000373002: favor DCHECK_CURRENTLY_ON for better logs in content/browser/[f-p]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/fileapi/fileapi_message_filter.cc
diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc
index b4ef0cea7c125c4e5a9f6292322912dfea8fecfd..ca67e188207080a054ed968347622f679c5a8d40 100644
--- a/content/browser/fileapi/fileapi_message_filter.cc
+++ b/content/browser/fileapi/fileapi_message_filter.cc
@@ -106,7 +106,7 @@ FileAPIMessageFilter::FileAPIMessageFilter(
}
void FileAPIMessageFilter::OnChannelConnected(int32 peer_pid) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (request_context_getter_.get()) {
DCHECK(!request_context_);
@@ -122,7 +122,7 @@ void FileAPIMessageFilter::OnChannelConnected(int32 peer_pid) {
}
void FileAPIMessageFilter::OnChannelClosing() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
// Unregister all the blob and stream URLs that are previously registered in
// this process.
@@ -206,7 +206,7 @@ void FileAPIMessageFilter::BadMessageReceived() {
void FileAPIMessageFilter::OnOpenFileSystem(int request_id,
const GURL& origin_url,
storage::FileSystemType type) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (type == storage::kFileSystemTypeTemporary) {
RecordAction(base::UserMetricsAction("OpenFileSystemTemporary"));
} else if (type == storage::kFileSystemTypePersistent) {
@@ -221,7 +221,7 @@ void FileAPIMessageFilter::OnOpenFileSystem(int request_id,
void FileAPIMessageFilter::OnResolveURL(
int request_id,
const GURL& filesystem_url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
FileSystemURL url(context_->CrackURL(filesystem_url));
if (!ValidateFileSystemURL(request_id, url))
return;
@@ -238,14 +238,14 @@ void FileAPIMessageFilter::OnResolveURL(
void FileAPIMessageFilter::OnDeleteFileSystem(int request_id,
const GURL& origin_url,
storage::FileSystemType type) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
context_->DeleteFileSystem(origin_url, type, base::Bind(
&FileAPIMessageFilter::DidDeleteFileSystem, this, request_id));
}
void FileAPIMessageFilter::OnMove(
int request_id, const GURL& src_path, const GURL& dest_path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
FileSystemURL src_url(context_->CrackURL(src_path));
FileSystemURL dest_url(context_->CrackURL(dest_path));
if (!ValidateFileSystemURL(request_id, src_url) ||
@@ -269,7 +269,7 @@ void FileAPIMessageFilter::OnMove(
void FileAPIMessageFilter::OnCopy(
int request_id, const GURL& src_path, const GURL& dest_path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
FileSystemURL src_url(context_->CrackURL(src_path));
FileSystemURL dest_url(context_->CrackURL(dest_path));
if (!ValidateFileSystemURL(request_id, src_url) ||
@@ -293,7 +293,7 @@ void FileAPIMessageFilter::OnCopy(
void FileAPIMessageFilter::OnRemove(
int request_id, const GURL& path, bool recursive) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
FileSystemURL url(context_->CrackURL(path));
if (!ValidateFileSystemURL(request_id, url))
return;
@@ -310,7 +310,7 @@ void FileAPIMessageFilter::OnRemove(
void FileAPIMessageFilter::OnReadMetadata(
int request_id, const GURL& path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
FileSystemURL url(context_->CrackURL(path));
if (!ValidateFileSystemURL(request_id, url))
return;
@@ -327,7 +327,7 @@ void FileAPIMessageFilter::OnReadMetadata(
void FileAPIMessageFilter::OnCreate(
int request_id, const GURL& path, bool exclusive,
bool is_directory, bool recursive) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
FileSystemURL url(context_->CrackURL(path));
if (!ValidateFileSystemURL(request_id, url))
return;
@@ -350,7 +350,7 @@ void FileAPIMessageFilter::OnCreate(
void FileAPIMessageFilter::OnExists(
int request_id, const GURL& path, bool is_directory) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
FileSystemURL url(context_->CrackURL(path));
if (!ValidateFileSystemURL(request_id, url))
return;
@@ -373,7 +373,7 @@ void FileAPIMessageFilter::OnExists(
void FileAPIMessageFilter::OnReadDirectory(
int request_id, const GURL& path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
FileSystemURL url(context_->CrackURL(path));
if (!ValidateFileSystemURL(request_id, url))
return;
@@ -393,7 +393,7 @@ void FileAPIMessageFilter::OnWrite(
const GURL& path,
const std::string& blob_uuid,
int64 offset) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (!request_context_) {
// We can't write w/o a request context, trying to do so will crash.
NOTREACHED();
@@ -440,7 +440,7 @@ void FileAPIMessageFilter::OnTouchFile(
const GURL& path,
const base::Time& last_access_time,
const base::Time& last_modified_time) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
FileSystemURL url(context_->CrackURL(path));
if (!ValidateFileSystemURL(request_id, url))
return;
@@ -458,7 +458,7 @@ void FileAPIMessageFilter::OnTouchFile(
void FileAPIMessageFilter::OnCancel(
int request_id,
int request_id_to_cancel) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
OperationsMap::iterator found = operations_.find(request_id_to_cancel);
if (found != operations_.end()) {
@@ -481,7 +481,7 @@ void FileAPIMessageFilter::OnSyncGetPlatformPath(
void FileAPIMessageFilter::OnCreateSnapshotFile(
int request_id, const GURL& path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
FileSystemURL url(context_->CrackURL(path));
// Make sure if this file can be read by the renderer as this is
@@ -510,19 +510,19 @@ void FileAPIMessageFilter::OnCreateSnapshotFile(
}
void FileAPIMessageFilter::OnDidReceiveSnapshotFile(int request_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
in_transit_snapshot_files_.erase(request_id);
}
void FileAPIMessageFilter::OnStartBuildingBlob(const std::string& uuid) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
ignore_result(blob_storage_host_->StartBuildingBlob(uuid));
}
void FileAPIMessageFilter::OnAppendBlobDataItemToBlob(
const std::string& uuid,
const storage::DataElement& item) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (item.type() == storage::DataElement::TYPE_FILE_FILESYSTEM) {
FileSystemURL filesystem_url(context_->CrackURL(item.filesystem_url()));
if (!FileSystemURLIsValid(context_, filesystem_url) ||
@@ -570,35 +570,35 @@ void FileAPIMessageFilter::OnAppendSharedMemoryToBlob(
void FileAPIMessageFilter::OnFinishBuildingBlob(
const std::string& uuid, const std::string& content_type) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
ignore_result(blob_storage_host_->FinishBuildingBlob(uuid, content_type));
// TODO(michaeln): check return values once blink has migrated, crbug/174200
}
void FileAPIMessageFilter::OnIncrementBlobRefCount(const std::string& uuid) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
ignore_result(blob_storage_host_->IncrementBlobRefCount(uuid));
}
void FileAPIMessageFilter::OnDecrementBlobRefCount(const std::string& uuid) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
ignore_result(blob_storage_host_->DecrementBlobRefCount(uuid));
}
void FileAPIMessageFilter::OnRegisterPublicBlobURL(
const GURL& public_url, const std::string& uuid) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
ignore_result(blob_storage_host_->RegisterPublicBlobURL(public_url, uuid));
}
void FileAPIMessageFilter::OnRevokePublicBlobURL(const GURL& public_url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
ignore_result(blob_storage_host_->RevokePublicBlobURL(public_url));
}
void FileAPIMessageFilter::OnStartBuildingStream(
const GURL& url, const std::string& content_type) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
// Only an internal Blob URL is expected here. See the BlobURL of the Blink.
if (!StartsWithASCII(
url.path(), "blobinternal%3A///", true /* case_sensitive */)) {
@@ -617,7 +617,7 @@ void FileAPIMessageFilter::OnStartBuildingStream(
void FileAPIMessageFilter::OnAppendBlobDataItemToStream(
const GURL& url,
const storage::DataElement& item) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
scoped_refptr<Stream> stream(GetStreamForURL(url));
// Stream instances may be deleted on error. Just abort if there's no Stream
@@ -658,21 +658,21 @@ void FileAPIMessageFilter::OnAppendSharedMemoryToStream(
}
void FileAPIMessageFilter::OnFlushStream(const GURL& url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
scoped_refptr<Stream> stream(GetStreamForURL(url));
if (stream.get())
stream->Flush();
}
void FileAPIMessageFilter::OnFinishBuildingStream(const GURL& url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
scoped_refptr<Stream> stream(GetStreamForURL(url));
if (stream.get())
stream->Finalize();
}
void FileAPIMessageFilter::OnAbortBuildingStream(const GURL& url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
scoped_refptr<Stream> stream(GetStreamForURL(url));
if (stream.get())
stream->Abort();
@@ -680,7 +680,7 @@ void FileAPIMessageFilter::OnAbortBuildingStream(const GURL& url) {
void FileAPIMessageFilter::OnCloneStream(
const GURL& url, const GURL& src_url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
// Abort if there's no Stream instance for |src_url| (source Stream which
// we're going to make |url| point to) in the registry.
if (!GetStreamForURL(src_url).get())
@@ -691,7 +691,7 @@ void FileAPIMessageFilter::OnCloneStream(
}
void FileAPIMessageFilter::OnRemoveStream(const GURL& url) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (!GetStreamForURL(url).get())
return;
@@ -769,7 +769,7 @@ void FileAPIMessageFilter::DidOpenFileSystem(int request_id,
const GURL& root,
const std::string& filesystem_name,
base::File::Error result) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (result == base::File::FILE_OK) {
DCHECK(root.is_valid());
Send(new FileSystemMsg_DidOpenFileSystem(
@@ -786,7 +786,7 @@ void FileAPIMessageFilter::DidResolveURL(
const storage::FileSystemInfo& info,
const base::FilePath& file_path,
storage::FileSystemContext::ResolvedEntryType type) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (result == base::File::FILE_OK &&
type == storage::FileSystemContext::RESOLVED_ENTRY_NOT_FOUND)
result = base::File::FILE_ERROR_NOT_FOUND;
@@ -822,7 +822,7 @@ void FileAPIMessageFilter::DidCreateSnapshot(
const base::File::Info& info,
const base::FilePath& platform_path,
const scoped_refptr<storage::ShareableFileReference>& /* unused */) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
operations_.erase(request_id);
if (result != base::File::FILE_OK) {
« no previous file with comments | « content/browser/fileapi/file_system_browsertest.cc ('k') | content/browser/frame_host/cross_site_transferring_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698