Commit 7667e30f authored by Stuart Langley's avatar Stuart Langley Committed by Commit Bot

Cleanup/Modernize code in chrome/browser/chromeos/drive

Some cleanup work for chrome/browser/chromeos/drive briging it in line
with recomended practices/c++ modernization.

- Use ThreadChecker macros.
- s/DCHECK(!callback.is_null())/DCHECK(callback)/

Ths CL introduces no logic changes.

Bug: 841659
Change-Id: I5a5784d2de7d8f1be0e6240414d7c64c921d3cff
Reviewed-on: https://chromium-review.googlesource.com/1122029Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Stuart Langley <slangley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572019}
parent e1cdab9d
...@@ -32,7 +32,7 @@ void IterateFileCacheInternal( ...@@ -32,7 +32,7 @@ void IterateFileCacheInternal(
void RunGetResourceEntryCallback(const GetResourceEntryCallback& callback, void RunGetResourceEntryCallback(const GetResourceEntryCallback& callback,
std::unique_ptr<ResourceEntry> entry, std::unique_ptr<ResourceEntry> entry,
FileError error) { FileError error) {
DCHECK(!callback.is_null()); DCHECK(callback);
if (error != FILE_ERROR_OK) if (error != FILE_ERROR_OK)
entry.reset(); entry.reset();
callback.Run(error, std::move(entry)); callback.Run(error, std::move(entry));
...@@ -43,7 +43,7 @@ void RunReadDirectoryCallback( ...@@ -43,7 +43,7 @@ void RunReadDirectoryCallback(
const DebugInfoCollector::ReadDirectoryCallback& callback, const DebugInfoCollector::ReadDirectoryCallback& callback,
std::unique_ptr<ResourceEntryVector> entries, std::unique_ptr<ResourceEntryVector> entries,
FileError error) { FileError error) {
DCHECK(!callback.is_null()); DCHECK(callback);
if (error != FILE_ERROR_OK) if (error != FILE_ERROR_OK)
entries.reset(); entries.reset();
callback.Run(error, std::move(entries)); callback.Run(error, std::move(entries));
...@@ -67,8 +67,8 @@ DebugInfoCollector::~DebugInfoCollector() = default; ...@@ -67,8 +67,8 @@ DebugInfoCollector::~DebugInfoCollector() = default;
void DebugInfoCollector::GetResourceEntry( void DebugInfoCollector::GetResourceEntry(
const base::FilePath& file_path, const base::FilePath& file_path,
const GetResourceEntryCallback& callback) { const GetResourceEntryCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!callback.is_null()); DCHECK(callback);
std::unique_ptr<ResourceEntry> entry(new ResourceEntry); std::unique_ptr<ResourceEntry> entry(new ResourceEntry);
ResourceEntry* entry_ptr = entry.get(); ResourceEntry* entry_ptr = entry.get();
...@@ -85,8 +85,8 @@ void DebugInfoCollector::GetResourceEntry( ...@@ -85,8 +85,8 @@ void DebugInfoCollector::GetResourceEntry(
void DebugInfoCollector::ReadDirectory( void DebugInfoCollector::ReadDirectory(
const base::FilePath& file_path, const base::FilePath& file_path,
const ReadDirectoryCallback& callback) { const ReadDirectoryCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!callback.is_null()); DCHECK(callback);
std::unique_ptr<ResourceEntryVector> entries(new ResourceEntryVector); std::unique_ptr<ResourceEntryVector> entries(new ResourceEntryVector);
ResourceEntryVector* entries_ptr = entries.get(); ResourceEntryVector* entries_ptr = entries.get();
...@@ -103,9 +103,9 @@ void DebugInfoCollector::ReadDirectory( ...@@ -103,9 +103,9 @@ void DebugInfoCollector::ReadDirectory(
void DebugInfoCollector::IterateFileCache( void DebugInfoCollector::IterateFileCache(
const IterateFileCacheCallback& iteration_callback, const IterateFileCacheCallback& iteration_callback,
const base::Closure& completion_callback) { const base::Closure& completion_callback) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!iteration_callback.is_null()); DCHECK(iteration_callback);
DCHECK(!completion_callback.is_null()); DCHECK(completion_callback);
blocking_task_runner_->PostTaskAndReply( blocking_task_runner_->PostTaskAndReply(
FROM_HERE, FROM_HERE,
...@@ -116,8 +116,8 @@ void DebugInfoCollector::IterateFileCache( ...@@ -116,8 +116,8 @@ void DebugInfoCollector::IterateFileCache(
void DebugInfoCollector::GetMetadata( void DebugInfoCollector::GetMetadata(
const GetFilesystemMetadataCallback& callback) { const GetFilesystemMetadataCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!callback.is_null()); DCHECK(callback);
// Currently, this is just a proxy to the FileSystem. // Currently, this is just a proxy to the FileSystem.
// TODO(hidehiko): Move the implementation to here to simplify the // TODO(hidehiko): Move the implementation to here to simplify the
......
...@@ -58,7 +58,7 @@ class DebugInfoCollector { ...@@ -58,7 +58,7 @@ class DebugInfoCollector {
FileSystemInterface* file_system_; // Not owned. FileSystemInterface* file_system_; // Not owned.
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
base::ThreadChecker thread_checker_; THREAD_CHECKER(thread_checker_);
DISALLOW_COPY_AND_ASSIGN(DebugInfoCollector); DISALLOW_COPY_AND_ASSIGN(DebugInfoCollector);
}; };
......
...@@ -111,7 +111,7 @@ LocalReaderProxy::~LocalReaderProxy() = default; ...@@ -111,7 +111,7 @@ LocalReaderProxy::~LocalReaderProxy() = default;
int LocalReaderProxy::Read(net::IOBuffer* buffer, int buffer_length, int LocalReaderProxy::Read(net::IOBuffer* buffer, int buffer_length,
const net::CompletionCallback& callback) { const net::CompletionCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(file_reader_); DCHECK(file_reader_);
if (buffer_length > remaining_length_) { if (buffer_length > remaining_length_) {
...@@ -141,7 +141,7 @@ void LocalReaderProxy::OnCompleted(FileError error) { ...@@ -141,7 +141,7 @@ void LocalReaderProxy::OnCompleted(FileError error) {
void LocalReaderProxy::OnReadCompleted(const net::CompletionCallback& callback, void LocalReaderProxy::OnReadCompleted(const net::CompletionCallback& callback,
int read_result) { int read_result) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(file_reader_); DCHECK(file_reader_);
if (read_result >= 0) { if (read_result >= 0) {
...@@ -174,7 +174,7 @@ NetworkReaderProxy::~NetworkReaderProxy() { ...@@ -174,7 +174,7 @@ NetworkReaderProxy::~NetworkReaderProxy() {
int NetworkReaderProxy::Read(net::IOBuffer* buffer, int buffer_length, int NetworkReaderProxy::Read(net::IOBuffer* buffer, int buffer_length,
const net::CompletionCallback& callback) { const net::CompletionCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// Check if there is no pending Read operation. // Check if there is no pending Read operation.
DCHECK(!buffer_.get()); DCHECK(!buffer_.get());
DCHECK_EQ(buffer_length_, 0); DCHECK_EQ(buffer_length_, 0);
...@@ -182,7 +182,7 @@ int NetworkReaderProxy::Read(net::IOBuffer* buffer, int buffer_length, ...@@ -182,7 +182,7 @@ int NetworkReaderProxy::Read(net::IOBuffer* buffer, int buffer_length,
// Validate the arguments. // Validate the arguments.
DCHECK(buffer); DCHECK(buffer);
DCHECK_GT(buffer_length, 0); DCHECK_GT(buffer_length, 0);
DCHECK(!callback.is_null()); DCHECK(callback);
if (error_code_ != net::OK) { if (error_code_ != net::OK) {
// An error is already found. Return it immediately. // An error is already found. Return it immediately.
...@@ -221,7 +221,7 @@ int NetworkReaderProxy::Read(net::IOBuffer* buffer, int buffer_length, ...@@ -221,7 +221,7 @@ int NetworkReaderProxy::Read(net::IOBuffer* buffer, int buffer_length,
} }
void NetworkReaderProxy::OnGetContent(std::unique_ptr<std::string> data) { void NetworkReaderProxy::OnGetContent(std::unique_ptr<std::string> data) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(data && !data->empty()); DCHECK(data && !data->empty());
if (remaining_offset_ >= static_cast<int64_t>(data->length())) { if (remaining_offset_ >= static_cast<int64_t>(data->length())) {
...@@ -256,7 +256,7 @@ void NetworkReaderProxy::OnGetContent(std::unique_ptr<std::string> data) { ...@@ -256,7 +256,7 @@ void NetworkReaderProxy::OnGetContent(std::unique_ptr<std::string> data) {
} }
void NetworkReaderProxy::OnCompleted(FileError error) { void NetworkReaderProxy::OnCompleted(FileError error) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// The downloading is completed, so we do not need to cancel the job // The downloading is completed, so we do not need to cancel the job
// in the destructor. // in the destructor.
job_canceller_.Reset(); job_canceller_.Reset();
...@@ -341,7 +341,7 @@ DriveFileStreamReader::DriveFileStreamReader( ...@@ -341,7 +341,7 @@ DriveFileStreamReader::DriveFileStreamReader(
DriveFileStreamReader::~DriveFileStreamReader() = default; DriveFileStreamReader::~DriveFileStreamReader() = default;
bool DriveFileStreamReader::IsInitialized() const { bool DriveFileStreamReader::IsInitialized() const {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
return reader_proxy_.get() != nullptr; return reader_proxy_.get() != nullptr;
} }
...@@ -349,8 +349,8 @@ void DriveFileStreamReader::Initialize( ...@@ -349,8 +349,8 @@ void DriveFileStreamReader::Initialize(
const base::FilePath& drive_file_path, const base::FilePath& drive_file_path,
const net::HttpByteRange& byte_range, const net::HttpByteRange& byte_range,
const InitializeCompletionCallback& callback) { const InitializeCompletionCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(!callback.is_null()); DCHECK(callback);
GetFileContent( GetFileContent(
file_system_getter_, file_system_getter_,
...@@ -371,16 +371,16 @@ void DriveFileStreamReader::Initialize( ...@@ -371,16 +371,16 @@ void DriveFileStreamReader::Initialize(
int DriveFileStreamReader::Read(net::IOBuffer* buffer, int buffer_length, int DriveFileStreamReader::Read(net::IOBuffer* buffer, int buffer_length,
const net::CompletionCallback& callback) { const net::CompletionCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(reader_proxy_); DCHECK(reader_proxy_);
DCHECK(buffer); DCHECK(buffer);
DCHECK(!callback.is_null()); DCHECK(callback);
return reader_proxy_->Read(buffer, buffer_length, callback); return reader_proxy_->Read(buffer, buffer_length, callback);
} }
void DriveFileStreamReader::StoreCancelDownloadClosure( void DriveFileStreamReader::StoreCancelDownloadClosure(
const base::Closure& cancel_download_closure) { const base::Closure& cancel_download_closure) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
cancel_download_closure_ = cancel_download_closure; cancel_download_closure_ = cancel_download_closure;
} }
...@@ -390,7 +390,7 @@ void DriveFileStreamReader::InitializeAfterGetFileContentInitialized( ...@@ -390,7 +390,7 @@ void DriveFileStreamReader::InitializeAfterGetFileContentInitialized(
FileError error, FileError error,
const base::FilePath& local_cache_file_path, const base::FilePath& local_cache_file_path,
std::unique_ptr<ResourceEntry> entry) { std::unique_ptr<ResourceEntry> entry) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// StoreCancelDownloadClosure() should be called before this function. // StoreCancelDownloadClosure() should be called before this function.
DCHECK(!cancel_download_closure_.is_null()); DCHECK(!cancel_download_closure_.is_null());
...@@ -445,7 +445,7 @@ void DriveFileStreamReader::InitializeAfterLocalFileOpen( ...@@ -445,7 +445,7 @@ void DriveFileStreamReader::InitializeAfterLocalFileOpen(
std::unique_ptr<ResourceEntry> entry, std::unique_ptr<ResourceEntry> entry,
std::unique_ptr<util::LocalFileReader> file_reader, std::unique_ptr<util::LocalFileReader> file_reader,
int open_result) { int open_result) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (open_result != net::OK) { if (open_result != net::OK) {
callback.Run(net::ERR_FAILED, std::unique_ptr<ResourceEntry>()); callback.Run(net::ERR_FAILED, std::unique_ptr<ResourceEntry>());
...@@ -460,7 +460,7 @@ void DriveFileStreamReader::InitializeAfterLocalFileOpen( ...@@ -460,7 +460,7 @@ void DriveFileStreamReader::InitializeAfterLocalFileOpen(
void DriveFileStreamReader::OnGetContent( void DriveFileStreamReader::OnGetContent(
google_apis::DriveApiErrorCode error_code, google_apis::DriveApiErrorCode error_code,
std::unique_ptr<std::string> data) { std::unique_ptr<std::string> data) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(reader_proxy_); DCHECK(reader_proxy_);
reader_proxy_->OnGetContent(std::move(data)); reader_proxy_->OnGetContent(std::move(data));
} }
...@@ -468,7 +468,7 @@ void DriveFileStreamReader::OnGetContent( ...@@ -468,7 +468,7 @@ void DriveFileStreamReader::OnGetContent(
void DriveFileStreamReader::OnGetFileContentCompletion( void DriveFileStreamReader::OnGetFileContentCompletion(
const InitializeCompletionCallback& callback, const InitializeCompletionCallback& callback,
FileError error) { FileError error) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (reader_proxy_) { if (reader_proxy_) {
// If the proxy object available, send the error to it. // If the proxy object available, send the error to it.
......
...@@ -81,7 +81,7 @@ class LocalReaderProxy : public ReaderProxy { ...@@ -81,7 +81,7 @@ class LocalReaderProxy : public ReaderProxy {
// The number of remaining bytes to be read. // The number of remaining bytes to be read.
int64_t remaining_length_; int64_t remaining_length_;
base::ThreadChecker thread_checker_; THREAD_CHECKER(thread_checker_);
// This should remain the last member so it'll be destroyed first and // This should remain the last member so it'll be destroyed first and
// invalidate its weak pointers before other members are destroyed. // invalidate its weak pointers before other members are destroyed.
...@@ -131,7 +131,7 @@ class NetworkReaderProxy : public ReaderProxy { ...@@ -131,7 +131,7 @@ class NetworkReaderProxy : public ReaderProxy {
int buffer_length_; int buffer_length_;
net::CompletionCallback callback_; net::CompletionCallback callback_;
base::ThreadChecker thread_checker_; THREAD_CHECKER(thread_checker_);
// Keeps the closure to cancel downloading job if necessary. // Keeps the closure to cancel downloading job if necessary.
// Will be reset when the job is completed (regardless whether the job is // Will be reset when the job is completed (regardless whether the job is
...@@ -222,7 +222,7 @@ class DriveFileStreamReader { ...@@ -222,7 +222,7 @@ class DriveFileStreamReader {
base::Closure cancel_download_closure_; base::Closure cancel_download_closure_;
std::unique_ptr<internal::ReaderProxy> reader_proxy_; std::unique_ptr<internal::ReaderProxy> reader_proxy_;
base::ThreadChecker thread_checker_; THREAD_CHECKER(thread_checker_);
// This should remain the last member so it'll be destroyed first and // This should remain the last member so it'll be destroyed first and
// invalidate its weak pointers before other members are destroyed. // invalidate its weak pointers before other members are destroyed.
......
...@@ -553,7 +553,7 @@ void DriveIntegrationService::OnPushNotificationEnabled(bool enabled) { ...@@ -553,7 +553,7 @@ void DriveIntegrationService::OnPushNotificationEnabled(bool enabled) {
void DriveIntegrationService::ClearCacheAndRemountFileSystem( void DriveIntegrationService::ClearCacheAndRemountFileSystem(
const base::Callback<void(bool)>& callback) { const base::Callback<void(bool)>& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!callback.is_null()); DCHECK(callback);
// TODO(crbug.com/845393): Implement for DriveFS. // TODO(crbug.com/845393): Implement for DriveFS.
if (state_ != INITIALIZED || drivefs_holder_) { if (state_ != INITIALIZED || drivefs_holder_) {
...@@ -589,7 +589,7 @@ void DriveIntegrationService::AddBackDriveMountPoint( ...@@ -589,7 +589,7 @@ void DriveIntegrationService::AddBackDriveMountPoint(
const base::Callback<void(bool)>& callback, const base::Callback<void(bool)>& callback,
FileError error) { FileError error) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!callback.is_null()); DCHECK(callback);
state_ = error == FILE_ERROR_OK ? INITIALIZED : NOT_INITIALIZED; state_ = error == FILE_ERROR_OK ? INITIALIZED : NOT_INITIALIZED;
......
...@@ -190,7 +190,7 @@ void PrepareWritableFileAndRun(Profile* profile, ...@@ -190,7 +190,7 @@ void PrepareWritableFileAndRun(Profile* profile,
const base::FilePath& path, const base::FilePath& path,
const PrepareWritableFileCallback& callback) { const PrepareWritableFileCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!callback.is_null()); DCHECK(callback);
FileSystemInterface* file_system = GetFileSystemByProfile(profile); FileSystemInterface* file_system = GetFileSystemByProfile(profile);
if (!file_system || !IsUnderDriveMountPoint(path)) { if (!file_system || !IsUnderDriveMountPoint(path)) {
...@@ -209,7 +209,7 @@ void EnsureDirectoryExists(Profile* profile, ...@@ -209,7 +209,7 @@ void EnsureDirectoryExists(Profile* profile,
const base::FilePath& directory, const base::FilePath& directory,
const FileOperationCallback& callback) { const FileOperationCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!callback.is_null()); DCHECK(callback);
if (IsUnderDriveMountPoint(directory)) { if (IsUnderDriveMountPoint(directory)) {
FileSystemInterface* file_system = GetFileSystemByProfile(profile); FileSystemInterface* file_system = GetFileSystemByProfile(profile);
DCHECK(file_system); DCHECK(file_system);
......
...@@ -44,7 +44,7 @@ int WebkitFileStreamReaderImpl::Read(net::IOBuffer* buffer, ...@@ -44,7 +44,7 @@ int WebkitFileStreamReaderImpl::Read(net::IOBuffer* buffer,
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(stream_reader_); DCHECK(stream_reader_);
DCHECK(buffer); DCHECK(buffer);
DCHECK(!callback.is_null()); DCHECK(callback);
if (stream_reader_->IsInitialized()) if (stream_reader_->IsInitialized())
return stream_reader_->Read(buffer, buffer_length, callback); return stream_reader_->Read(buffer, buffer_length, callback);
...@@ -67,7 +67,7 @@ int64_t WebkitFileStreamReaderImpl::GetLength( ...@@ -67,7 +67,7 @@ int64_t WebkitFileStreamReaderImpl::GetLength(
const net::Int64CompletionCallback& callback) { const net::Int64CompletionCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(stream_reader_); DCHECK(stream_reader_);
DCHECK(!callback.is_null()); DCHECK(callback);
if (stream_reader_->IsInitialized()) { if (stream_reader_->IsInitialized()) {
// Returns file_size regardless of |offset_|. // Returns file_size regardless of |offset_|.
...@@ -94,7 +94,7 @@ void WebkitFileStreamReaderImpl::OnStreamReaderInitialized( ...@@ -94,7 +94,7 @@ void WebkitFileStreamReaderImpl::OnStreamReaderInitialized(
std::unique_ptr<ResourceEntry> entry) { std::unique_ptr<ResourceEntry> entry) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(stream_reader_); DCHECK(stream_reader_);
DCHECK(!callback.is_null()); DCHECK(callback);
// TODO(hashimoto): Report ERR_UPLOAD_FILE_CHANGED when modification time // TODO(hashimoto): Report ERR_UPLOAD_FILE_CHANGED when modification time
// doesn't match. crbug.com/346625 // doesn't match. crbug.com/346625
...@@ -116,7 +116,7 @@ void WebkitFileStreamReaderImpl::ReadAfterStreamReaderInitialized( ...@@ -116,7 +116,7 @@ void WebkitFileStreamReaderImpl::ReadAfterStreamReaderInitialized(
const net::CompletionCallback& callback, const net::CompletionCallback& callback,
int initialization_result) { int initialization_result) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(!callback.is_null()); DCHECK(callback);
if (initialization_result != net::OK) { if (initialization_result != net::OK) {
callback.Run(initialization_result); callback.Run(initialization_result);
...@@ -133,7 +133,7 @@ void WebkitFileStreamReaderImpl::GetLengthAfterStreamReaderInitialized( ...@@ -133,7 +133,7 @@ void WebkitFileStreamReaderImpl::GetLengthAfterStreamReaderInitialized(
const net::Int64CompletionCallback& callback, const net::Int64CompletionCallback& callback,
int initialization_result) { int initialization_result) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(!callback.is_null()); DCHECK(callback);
if (initialization_result != net::OK) { if (initialization_result != net::OK) {
callback.Run(initialization_result); callback.Run(initialization_result);
......
...@@ -68,7 +68,7 @@ int WebkitFileStreamWriterImpl::Write(net::IOBuffer* buf, ...@@ -68,7 +68,7 @@ int WebkitFileStreamWriterImpl::Write(net::IOBuffer* buf,
const net::CompletionCallback& callback) { const net::CompletionCallback& callback) {
DCHECK(pending_write_callback_.is_null()); DCHECK(pending_write_callback_.is_null());
DCHECK(pending_cancel_callback_.is_null()); DCHECK(pending_cancel_callback_.is_null());
DCHECK(!callback.is_null()); DCHECK(callback);
// If the local file is already available, just delegate to it. // If the local file is already available, just delegate to it.
if (local_file_writer_) if (local_file_writer_)
...@@ -90,7 +90,7 @@ int WebkitFileStreamWriterImpl::Write(net::IOBuffer* buf, ...@@ -90,7 +90,7 @@ int WebkitFileStreamWriterImpl::Write(net::IOBuffer* buf,
int WebkitFileStreamWriterImpl::Cancel( int WebkitFileStreamWriterImpl::Cancel(
const net::CompletionCallback& callback) { const net::CompletionCallback& callback) {
DCHECK(pending_cancel_callback_.is_null()); DCHECK(pending_cancel_callback_.is_null());
DCHECK(!callback.is_null()); DCHECK(callback);
// If LocalFileWriter is already created, just delegate the cancel to it. // If LocalFileWriter is already created, just delegate the cancel to it.
if (local_file_writer_) if (local_file_writer_)
...@@ -111,7 +111,7 @@ int WebkitFileStreamWriterImpl::Cancel( ...@@ -111,7 +111,7 @@ int WebkitFileStreamWriterImpl::Cancel(
int WebkitFileStreamWriterImpl::Flush(const net::CompletionCallback& callback) { int WebkitFileStreamWriterImpl::Flush(const net::CompletionCallback& callback) {
DCHECK(pending_cancel_callback_.is_null()); DCHECK(pending_cancel_callback_.is_null());
DCHECK(!callback.is_null()); DCHECK(callback);
// If LocalFileWriter is already created, just delegate to it. // If LocalFileWriter is already created, just delegate to it.
if (local_file_writer_) if (local_file_writer_)
......
...@@ -22,7 +22,7 @@ void RunCloseCallbackAndReplyTask(const base::Closure& close_callback, ...@@ -22,7 +22,7 @@ void RunCloseCallbackAndReplyTask(const base::Closure& close_callback,
FileError error) { FileError error) {
if (!close_callback.is_null()) if (!close_callback.is_null())
close_callback.Run(); close_callback.Run();
DCHECK(!reply.is_null()); DCHECK(reply);
reply.Run(error); reply.Run(error);
} }
...@@ -61,8 +61,8 @@ void WriteOnCacheFileAndReply(FileSystemInterface* file_system, ...@@ -61,8 +61,8 @@ void WriteOnCacheFileAndReply(FileSystemInterface* file_system,
const FileOperationCallback& reply) { const FileOperationCallback& reply) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(file_system); DCHECK(file_system);
DCHECK(!callback.is_null()); DCHECK(callback);
DCHECK(!reply.is_null()); DCHECK(reply);
file_system->OpenFile( file_system->OpenFile(
path, path,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment