Commit ad1e8c96 authored by mostynb's avatar mostynb Committed by Commit bot

favor DCHECK_CURRENTLY_ON for better logs in components/

BUG=466848

Review URL: https://codereview.chromium.org/1004933003

Cr-Commit-Position: refs/heads/master@{#322240}
parent 558ef66f
...@@ -35,7 +35,7 @@ CrashDumpManager* CrashDumpManager::GetInstance() { ...@@ -35,7 +35,7 @@ CrashDumpManager* CrashDumpManager::GetInstance() {
CrashDumpManager::CrashDumpManager(const base::FilePath& crash_dump_dir) CrashDumpManager::CrashDumpManager(const base::FilePath& crash_dump_dir)
: crash_dump_dir_(crash_dump_dir) { : crash_dump_dir_(crash_dump_dir) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!instance_); DCHECK(!instance_);
instance_ = this; instance_ = this;
...@@ -83,7 +83,7 @@ base::File CrashDumpManager::CreateMinidumpFile(int child_process_id) { ...@@ -83,7 +83,7 @@ base::File CrashDumpManager::CreateMinidumpFile(int child_process_id) {
// static // static
void CrashDumpManager::ProcessMinidump(const base::FilePath& minidump_path, void CrashDumpManager::ProcessMinidump(const base::FilePath& minidump_path,
base::ProcessHandle pid) { base::ProcessHandle pid) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
CHECK(instance_); CHECK(instance_);
int64 file_size = 0; int64 file_size = 0;
int r = base::GetFileSize(minidump_path, &file_size); int r = base::GetFileSize(minidump_path, &file_size);
......
...@@ -402,7 +402,7 @@ void CrashHandlerHostLinux::WriteDumpFile(scoped_ptr<BreakpadInfo> info, ...@@ -402,7 +402,7 @@ void CrashHandlerHostLinux::WriteDumpFile(scoped_ptr<BreakpadInfo> info,
void CrashHandlerHostLinux::QueueCrashDumpTask(scoped_ptr<BreakpadInfo> info, void CrashHandlerHostLinux::QueueCrashDumpTask(scoped_ptr<BreakpadInfo> info,
int signal_fd) { int signal_fd) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK_CURRENTLY_ON(BrowserThread::IO);
// Send the done signal to the process: it can exit now. // Send the done signal to the process: it can exit now.
struct msghdr msg = {0}; struct msghdr msg = {0};
......
...@@ -44,7 +44,7 @@ void FeedbackData::OnFeedbackPageDataComplete() { ...@@ -44,7 +44,7 @@ void FeedbackData::OnFeedbackPageDataComplete() {
void FeedbackData::SetAndCompressSystemInfo( void FeedbackData::SetAndCompressSystemInfo(
scoped_ptr<FeedbackData::SystemLogsMap> sys_info) { scoped_ptr<FeedbackData::SystemLogsMap> sys_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (trace_id_ != 0) { if (trace_id_ != 0) {
TracingManager* manager = TracingManager::Get(); TracingManager* manager = TracingManager::Get();
...@@ -70,7 +70,7 @@ void FeedbackData::SetAndCompressSystemInfo( ...@@ -70,7 +70,7 @@ void FeedbackData::SetAndCompressSystemInfo(
void FeedbackData::SetAndCompressHistograms( void FeedbackData::SetAndCompressHistograms(
scoped_ptr<std::string> histograms) { scoped_ptr<std::string> histograms) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!histograms.get()) if (!histograms.get())
return; return;
...@@ -87,7 +87,7 @@ void FeedbackData::SetAndCompressHistograms( ...@@ -87,7 +87,7 @@ void FeedbackData::SetAndCompressHistograms(
void FeedbackData::AttachAndCompressFileData( void FeedbackData::AttachAndCompressFileData(
scoped_ptr<std::string> attached_filedata) { scoped_ptr<std::string> attached_filedata) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!attached_filedata.get() || attached_filedata->empty()) if (!attached_filedata.get() || attached_filedata->empty())
return; return;
...@@ -107,7 +107,7 @@ void FeedbackData::AttachAndCompressFileData( ...@@ -107,7 +107,7 @@ void FeedbackData::AttachAndCompressFileData(
void FeedbackData::OnGetTraceData( void FeedbackData::OnGetTraceData(
int trace_id, int trace_id,
scoped_refptr<base::RefCountedString> trace_data) { scoped_refptr<base::RefCountedString> trace_data) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
TracingManager* manager = TracingManager::Get(); TracingManager* manager = TracingManager::Get();
if (manager) if (manager)
manager->DiscardTraceData(trace_id); manager->DiscardTraceData(trace_id);
...@@ -124,7 +124,7 @@ void FeedbackData::OnGetTraceData( ...@@ -124,7 +124,7 @@ void FeedbackData::OnGetTraceData(
} }
void FeedbackData::OnCompressComplete() { void FeedbackData::OnCompressComplete() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
--pending_op_count_; --pending_op_count_;
SendReport(); SendReport();
} }
...@@ -134,7 +134,7 @@ bool FeedbackData::IsDataComplete() { ...@@ -134,7 +134,7 @@ bool FeedbackData::IsDataComplete() {
} }
void FeedbackData::SendReport() { void FeedbackData::SendReport() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (IsDataComplete() && !report_sent_) { if (IsDataComplete() && !report_sent_) {
report_sent_ = true; report_sent_ = true;
send_report_.Run(this); send_report_.Run(this);
......
...@@ -54,23 +54,23 @@ class TrackingSynchronizer::RequestContext { ...@@ -54,23 +54,23 @@ class TrackingSynchronizer::RequestContext {
~RequestContext() {} ~RequestContext() {}
void SetReceivedProcessGroupCount(bool done) { void SetReceivedProcessGroupCount(bool done) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
received_process_group_count_ = done; received_process_group_count_ = done;
} }
// Methods for book keeping of processes_pending_. // Methods for book keeping of processes_pending_.
void IncrementProcessesPending() { void IncrementProcessesPending() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
++processes_pending_; ++processes_pending_;
} }
void AddProcessesPending(int processes_pending) { void AddProcessesPending(int processes_pending) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
processes_pending_ += processes_pending; processes_pending_ += processes_pending;
} }
void DecrementProcessesPending() { void DecrementProcessesPending() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
--processes_pending_; --processes_pending_;
} }
...@@ -79,7 +79,7 @@ class TrackingSynchronizer::RequestContext { ...@@ -79,7 +79,7 @@ class TrackingSynchronizer::RequestContext {
// |processes_pending_| are zero, then delete the current object by calling // |processes_pending_| are zero, then delete the current object by calling
// Unregister. // Unregister.
void DeleteIfAllDone() { void DeleteIfAllDone() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (processes_pending_ <= 0 && received_process_group_count_) if (processes_pending_ <= 0 && received_process_group_count_)
RequestContext::Unregister(sequence_number_); RequestContext::Unregister(sequence_number_);
...@@ -90,7 +90,7 @@ class TrackingSynchronizer::RequestContext { ...@@ -90,7 +90,7 @@ class TrackingSynchronizer::RequestContext {
static RequestContext* Register( static RequestContext* Register(
int sequence_number, int sequence_number,
const base::WeakPtr<TrackingSynchronizerObserver>& callback_object) { const base::WeakPtr<TrackingSynchronizerObserver>& callback_object) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
RequestContext* request = new RequestContext( RequestContext* request = new RequestContext(
callback_object, sequence_number); callback_object, sequence_number);
...@@ -102,7 +102,7 @@ class TrackingSynchronizer::RequestContext { ...@@ -102,7 +102,7 @@ class TrackingSynchronizer::RequestContext {
// Find the |RequestContext| in |outstanding_requests_| map for the given // Find the |RequestContext| in |outstanding_requests_| map for the given
// |sequence_number|. // |sequence_number|.
static RequestContext* GetRequestContext(int sequence_number) { static RequestContext* GetRequestContext(int sequence_number) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
RequestContextMap::iterator it = RequestContextMap::iterator it =
outstanding_requests_.Get().find(sequence_number); outstanding_requests_.Get().find(sequence_number);
...@@ -118,7 +118,7 @@ class TrackingSynchronizer::RequestContext { ...@@ -118,7 +118,7 @@ class TrackingSynchronizer::RequestContext {
// |outstanding_requests_| map. This method is called when all changes have // |outstanding_requests_| map. This method is called when all changes have
// been acquired, or when the wait time expires (whichever is sooner). // been acquired, or when the wait time expires (whichever is sooner).
static void Unregister(int sequence_number) { static void Unregister(int sequence_number) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
RequestContextMap::iterator it = RequestContextMap::iterator it =
outstanding_requests_.Get().find(sequence_number); outstanding_requests_.Get().find(sequence_number);
...@@ -198,7 +198,7 @@ TrackingSynchronizer::~TrackingSynchronizer() { ...@@ -198,7 +198,7 @@ TrackingSynchronizer::~TrackingSynchronizer() {
// static // static
void TrackingSynchronizer::FetchProfilerDataAsynchronously( void TrackingSynchronizer::FetchProfilerDataAsynchronously(
const base::WeakPtr<TrackingSynchronizerObserver>& callback_object) { const base::WeakPtr<TrackingSynchronizerObserver>& callback_object) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!g_tracking_synchronizer) { if (!g_tracking_synchronizer) {
// System teardown is happening. // System teardown is happening.
...@@ -219,7 +219,7 @@ void TrackingSynchronizer::FetchProfilerDataAsynchronously( ...@@ -219,7 +219,7 @@ void TrackingSynchronizer::FetchProfilerDataAsynchronously(
void TrackingSynchronizer::OnPendingProcesses(int sequence_number, void TrackingSynchronizer::OnPendingProcesses(int sequence_number,
int pending_processes, int pending_processes,
bool end) { bool end) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
RequestContext* request = RequestContext::GetRequestContext(sequence_number); RequestContext* request = RequestContext::GetRequestContext(sequence_number);
if (!request) if (!request)
...@@ -233,14 +233,14 @@ void TrackingSynchronizer::OnProfilerDataCollected( ...@@ -233,14 +233,14 @@ void TrackingSynchronizer::OnProfilerDataCollected(
int sequence_number, int sequence_number,
const tracked_objects::ProcessDataSnapshot& profiler_data, const tracked_objects::ProcessDataSnapshot& profiler_data,
int process_type) { int process_type) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DecrementPendingProcessesAndSendData(sequence_number, profiler_data, DecrementPendingProcessesAndSendData(sequence_number, profiler_data,
process_type); process_type);
} }
int TrackingSynchronizer::RegisterAndNotifyAllProcesses( int TrackingSynchronizer::RegisterAndNotifyAllProcesses(
const base::WeakPtr<TrackingSynchronizerObserver>& callback_object) { const base::WeakPtr<TrackingSynchronizerObserver>& callback_object) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
int sequence_number = GetNextAvailableSequenceNumber(); int sequence_number = GetNextAvailableSequenceNumber();
...@@ -266,7 +266,7 @@ void TrackingSynchronizer::DecrementPendingProcessesAndSendData( ...@@ -266,7 +266,7 @@ void TrackingSynchronizer::DecrementPendingProcessesAndSendData(
int sequence_number, int sequence_number,
const tracked_objects::ProcessDataSnapshot& profiler_data, const tracked_objects::ProcessDataSnapshot& profiler_data,
int process_type) { int process_type) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
RequestContext* request = RequestContext::GetRequestContext(sequence_number); RequestContext* request = RequestContext::GetRequestContext(sequence_number);
if (!request) if (!request)
...@@ -283,7 +283,7 @@ void TrackingSynchronizer::DecrementPendingProcessesAndSendData( ...@@ -283,7 +283,7 @@ void TrackingSynchronizer::DecrementPendingProcessesAndSendData(
} }
int TrackingSynchronizer::GetNextAvailableSequenceNumber() { int TrackingSynchronizer::GetNextAvailableSequenceNumber() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
++last_used_sequence_number_; ++last_used_sequence_number_;
......
...@@ -49,7 +49,7 @@ void DoRegisterOpenedNaClExecutableFile( ...@@ -49,7 +49,7 @@ void DoRegisterOpenedNaClExecutableFile(
IPC::Message* reply_msg, IPC::Message* reply_msg,
WriteFileInfoReply write_reply_message) { WriteFileInfoReply write_reply_message) {
// IO thread owns the NaClBrowser singleton. // IO thread owns the NaClBrowser singleton.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK_CURRENTLY_ON(BrowserThread::IO);
nacl::NaClBrowser* nacl_browser = nacl::NaClBrowser::GetInstance(); nacl::NaClBrowser* nacl_browser = nacl::NaClBrowser::GetInstance();
uint64 file_token_lo = 0; uint64 file_token_lo = 0;
......
...@@ -147,7 +147,7 @@ void PnaclHost::OnCacheInitialized(int net_error) { ...@@ -147,7 +147,7 @@ void PnaclHost::OnCacheInitialized(int net_error) {
void PnaclHost::Init() { void PnaclHost::Init() {
// Extra check that we're on the real IO thread since this version of // Extra check that we're on the real IO thread since this version of
// Init isn't used in unit tests. // Init isn't used in unit tests.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
base::FilePath cache_path(GetCachePath()); base::FilePath cache_path(GetCachePath());
if (cache_path.empty() || cache_state_ != CacheUninitialized) if (cache_path.empty() || cache_state_ != CacheUninitialized)
......
...@@ -32,7 +32,7 @@ const void* kInterceptNavigationDelegateUserDataKey = ...@@ -32,7 +32,7 @@ const void* kInterceptNavigationDelegateUserDataKey =
bool CheckIfShouldIgnoreNavigationOnUIThread(WebContents* source, bool CheckIfShouldIgnoreNavigationOnUIThread(WebContents* source,
const NavigationParams& params) { const NavigationParams& params) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(source); DCHECK(source);
InterceptNavigationDelegate* intercept_navigation_delegate = InterceptNavigationDelegate* intercept_navigation_delegate =
......
...@@ -73,7 +73,7 @@ InterceptNavigationResourceThrottle::InterceptNavigationResourceThrottle( ...@@ -73,7 +73,7 @@ InterceptNavigationResourceThrottle::InterceptNavigationResourceThrottle(
} }
InterceptNavigationResourceThrottle::~InterceptNavigationResourceThrottle() { InterceptNavigationResourceThrottle::~InterceptNavigationResourceThrottle() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK_CURRENTLY_ON(BrowserThread::IO);
} }
void InterceptNavigationResourceThrottle::WillStartRequest(bool* defer) { void InterceptNavigationResourceThrottle::WillStartRequest(bool* defer) {
...@@ -134,7 +134,7 @@ bool InterceptNavigationResourceThrottle::CheckIfShouldIgnoreNavigation( ...@@ -134,7 +134,7 @@ bool InterceptNavigationResourceThrottle::CheckIfShouldIgnoreNavigation(
void InterceptNavigationResourceThrottle::OnResultObtained( void InterceptNavigationResourceThrottle::OnResultObtained(
bool should_ignore_navigation) { bool should_ignore_navigation) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (should_ignore_navigation) { if (should_ignore_navigation) {
controller()->CancelAndIgnore(); controller()->CancelAndIgnore();
......
...@@ -55,7 +55,7 @@ bool PrecacheManager::IsPrecachingEnabled() { ...@@ -55,7 +55,7 @@ bool PrecacheManager::IsPrecachingEnabled() {
} }
bool PrecacheManager::IsPrecachingAllowed() { bool PrecacheManager::IsPrecachingAllowed() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
return user_prefs::UserPrefs::Get(browser_context_)->GetBoolean( return user_prefs::UserPrefs::Get(browser_context_)->GetBoolean(
data_reduction_proxy::prefs::kDataReductionProxyEnabled); data_reduction_proxy::prefs::kDataReductionProxyEnabled);
} }
...@@ -63,7 +63,7 @@ bool PrecacheManager::IsPrecachingAllowed() { ...@@ -63,7 +63,7 @@ bool PrecacheManager::IsPrecachingAllowed() {
void PrecacheManager::StartPrecaching( void PrecacheManager::StartPrecaching(
const PrecacheCompletionCallback& precache_completion_callback, const PrecacheCompletionCallback& precache_completion_callback,
URLListProvider* url_list_provider) { URLListProvider* url_list_provider) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (is_precaching_) { if (is_precaching_) {
DLOG(WARNING) << "Cannot start precaching because precaching is already " DLOG(WARNING) << "Cannot start precaching because precaching is already "
...@@ -84,7 +84,7 @@ void PrecacheManager::StartPrecaching( ...@@ -84,7 +84,7 @@ void PrecacheManager::StartPrecaching(
} }
void PrecacheManager::CancelPrecaching() { void PrecacheManager::CancelPrecaching() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!is_precaching_) { if (!is_precaching_) {
// Do nothing if precaching is not in progress. // Do nothing if precaching is not in progress.
...@@ -100,7 +100,7 @@ void PrecacheManager::CancelPrecaching() { ...@@ -100,7 +100,7 @@ void PrecacheManager::CancelPrecaching() {
} }
bool PrecacheManager::IsPrecaching() const { bool PrecacheManager::IsPrecaching() const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
return is_precaching_; return is_precaching_;
} }
...@@ -108,7 +108,7 @@ void PrecacheManager::RecordStatsForFetch(const GURL& url, ...@@ -108,7 +108,7 @@ void PrecacheManager::RecordStatsForFetch(const GURL& url,
const base::Time& fetch_time, const base::Time& fetch_time,
int64 size, int64 size,
bool was_cached) { bool was_cached) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (size == 0 || url.is_empty() || !url.SchemeIsHTTPOrHTTPS()) { if (size == 0 || url.is_empty() || !url.SchemeIsHTTPOrHTTPS()) {
// Ignore empty responses, empty URLs, or URLs that aren't HTTP or HTTPS. // Ignore empty responses, empty URLs, or URLs that aren't HTTP or HTTPS.
...@@ -142,7 +142,7 @@ void PrecacheManager::Shutdown() { ...@@ -142,7 +142,7 @@ void PrecacheManager::Shutdown() {
} }
void PrecacheManager::OnDone() { void PrecacheManager::OnDone() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
// If OnDone has been called, then we should just be finishing precaching. // If OnDone has been called, then we should just be finishing precaching.
DCHECK(is_precaching_); DCHECK(is_precaching_);
...@@ -156,7 +156,7 @@ void PrecacheManager::OnDone() { ...@@ -156,7 +156,7 @@ void PrecacheManager::OnDone() {
} }
void PrecacheManager::OnURLsReceived(const std::list<GURL>& urls) { void PrecacheManager::OnURLsReceived(const std::list<GURL>& urls) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!is_precaching_) { if (!is_precaching_) {
// Don't start precaching if it was canceled while waiting for the list of // Don't start precaching if it was canceled while waiting for the list of
......
...@@ -55,7 +55,7 @@ base::FilePath::StringType FindRemovableStorageLocationById( ...@@ -55,7 +55,7 @@ base::FilePath::StringType FindRemovableStorageLocationById(
} }
void FilterAttachedDevicesOnFileThread(MediaStorageUtil::DeviceIdSet* devices) { void FilterAttachedDevicesOnFileThread(MediaStorageUtil::DeviceIdSet* devices) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
MediaStorageUtil::DeviceIdSet missing_devices; MediaStorageUtil::DeviceIdSet missing_devices;
for (MediaStorageUtil::DeviceIdSet::const_iterator it = devices->begin(); for (MediaStorageUtil::DeviceIdSet::const_iterator it = devices->begin();
......
...@@ -115,7 +115,7 @@ void StorageMonitorCros::Init() { ...@@ -115,7 +115,7 @@ void StorageMonitorCros::Init() {
} }
void StorageMonitorCros::CheckExistingMountPoints() { void StorageMonitorCros::CheckExistingMountPoints() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
const DiskMountManager::MountPointMap& mount_point_map = const DiskMountManager::MountPointMap& mount_point_map =
DiskMountManager::GetInstance()->mount_points(); DiskMountManager::GetInstance()->mount_points();
for (DiskMountManager::MountPointMap::const_iterator it = for (DiskMountManager::MountPointMap::const_iterator it =
...@@ -148,7 +148,7 @@ void StorageMonitorCros::OnMountEvent( ...@@ -148,7 +148,7 @@ void StorageMonitorCros::OnMountEvent(
DiskMountManager::MountEvent event, DiskMountManager::MountEvent event,
chromeos::MountError error_code, chromeos::MountError error_code,
const DiskMountManager::MountPointInfo& mount_info) { const DiskMountManager::MountPointInfo& mount_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Ignore mount points that are not devices. // Ignore mount points that are not devices.
if (mount_info.mount_type != chromeos::MOUNT_TYPE_DEVICE) if (mount_info.mount_type != chromeos::MOUNT_TYPE_DEVICE)
...@@ -277,7 +277,7 @@ StorageMonitorCros::media_transfer_protocol_manager() { ...@@ -277,7 +277,7 @@ StorageMonitorCros::media_transfer_protocol_manager() {
void StorageMonitorCros::AddMountedPath( void StorageMonitorCros::AddMountedPath(
const DiskMountManager::MountPointInfo& mount_info, const DiskMountManager::MountPointInfo& mount_info,
bool has_dcim) { bool has_dcim) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (ContainsKey(mount_map_, mount_info.mount_path)) { if (ContainsKey(mount_map_, mount_info.mount_path)) {
// CheckExistingMountPointsOnUIThread() added the mount point information // CheckExistingMountPointsOnUIThread() added the mount point information
......
...@@ -119,7 +119,7 @@ uint64 GetDeviceStorageSize(const base::FilePath& device_path, ...@@ -119,7 +119,7 @@ uint64 GetDeviceStorageSize(const base::FilePath& device_path,
// Gets the device information using udev library. // Gets the device information using udev library.
scoped_ptr<StorageInfo> GetDeviceInfo(const base::FilePath& device_path, scoped_ptr<StorageInfo> GetDeviceInfo(const base::FilePath& device_path,
const base::FilePath& mount_point) { const base::FilePath& mount_point) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(!device_path.empty()); DCHECK(!device_path.empty());
scoped_ptr<StorageInfo> storage_info; scoped_ptr<StorageInfo> storage_info;
...@@ -198,7 +198,7 @@ scoped_ptr<StorageInfo> GetDeviceInfo(const base::FilePath& device_path, ...@@ -198,7 +198,7 @@ scoped_ptr<StorageInfo> GetDeviceInfo(const base::FilePath& device_path,
MtabWatcherLinux* CreateMtabWatcherLinuxOnFileThread( MtabWatcherLinux* CreateMtabWatcherLinuxOnFileThread(
const base::FilePath& mtab_path, const base::FilePath& mtab_path,
base::WeakPtr<MtabWatcherLinux::Delegate> delegate) { base::WeakPtr<MtabWatcherLinux::Delegate> delegate) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
// Owned by caller. // Owned by caller.
return new MtabWatcherLinux(mtab_path, delegate); return new MtabWatcherLinux(mtab_path, delegate);
} }
...@@ -206,7 +206,7 @@ MtabWatcherLinux* CreateMtabWatcherLinuxOnFileThread( ...@@ -206,7 +206,7 @@ MtabWatcherLinux* CreateMtabWatcherLinuxOnFileThread(
StorageMonitor::EjectStatus EjectPathOnFileThread( StorageMonitor::EjectStatus EjectPathOnFileThread(
const base::FilePath& path, const base::FilePath& path,
const base::FilePath& device) { const base::FilePath& device) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
// Note: Linux LSB says umount should exist in /bin. // Note: Linux LSB says umount should exist in /bin.
static const char kUmountBinary[] = "/bin/umount"; static const char kUmountBinary[] = "/bin/umount";
...@@ -244,11 +244,11 @@ StorageMonitorLinux::StorageMonitorLinux(const base::FilePath& path) ...@@ -244,11 +244,11 @@ StorageMonitorLinux::StorageMonitorLinux(const base::FilePath& path)
: mtab_path_(path), : mtab_path_(path),
get_device_info_callback_(base::Bind(&GetDeviceInfo)), get_device_info_callback_(base::Bind(&GetDeviceInfo)),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
} }
StorageMonitorLinux::~StorageMonitorLinux() { StorageMonitorLinux::~StorageMonitorLinux() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
} }
void StorageMonitorLinux::Init() { void StorageMonitorLinux::Init() {
...@@ -278,7 +278,7 @@ bool StorageMonitorLinux::GetStorageInfoForPath( ...@@ -278,7 +278,7 @@ bool StorageMonitorLinux::GetStorageInfoForPath(
const base::FilePath& path, const base::FilePath& path,
StorageInfo* device_info) const { StorageInfo* device_info) const {
DCHECK(device_info); DCHECK(device_info);
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
// TODO(thestig) |media_transfer_protocol_device_observer_| should always be // TODO(thestig) |media_transfer_protocol_device_observer_| should always be
// valid. // valid.
...@@ -359,12 +359,12 @@ void StorageMonitorLinux::EjectDevice( ...@@ -359,12 +359,12 @@ void StorageMonitorLinux::EjectDevice(
} }
void StorageMonitorLinux::OnMtabWatcherCreated(MtabWatcherLinux* watcher) { void StorageMonitorLinux::OnMtabWatcherCreated(MtabWatcherLinux* watcher) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
mtab_watcher_.reset(watcher); mtab_watcher_.reset(watcher);
} }
void StorageMonitorLinux::UpdateMtab(const MountPointDeviceMap& new_mtab) { void StorageMonitorLinux::UpdateMtab(const MountPointDeviceMap& new_mtab) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Check existing mtab entries for unaccounted mount points. // Check existing mtab entries for unaccounted mount points.
// These mount points must have been removed in the new mtab. // These mount points must have been removed in the new mtab.
...@@ -465,14 +465,14 @@ void StorageMonitorLinux::UpdateMtab(const MountPointDeviceMap& new_mtab) { ...@@ -465,14 +465,14 @@ void StorageMonitorLinux::UpdateMtab(const MountPointDeviceMap& new_mtab) {
bool StorageMonitorLinux::IsDeviceAlreadyMounted( bool StorageMonitorLinux::IsDeviceAlreadyMounted(
const base::FilePath& mount_device) const { const base::FilePath& mount_device) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
return ContainsKey(mount_priority_map_, mount_device); return ContainsKey(mount_priority_map_, mount_device);
} }
void StorageMonitorLinux::HandleDeviceMountedMultipleTimes( void StorageMonitorLinux::HandleDeviceMountedMultipleTimes(
const base::FilePath& mount_device, const base::FilePath& mount_device,
const base::FilePath& mount_point) { const base::FilePath& mount_point) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
MountPriorityMap::iterator priority = mount_priority_map_.find(mount_device); MountPriorityMap::iterator priority = mount_priority_map_.find(mount_device);
DCHECK(priority != mount_priority_map_.end()); DCHECK(priority != mount_priority_map_.end());
...@@ -484,7 +484,7 @@ void StorageMonitorLinux::HandleDeviceMountedMultipleTimes( ...@@ -484,7 +484,7 @@ void StorageMonitorLinux::HandleDeviceMountedMultipleTimes(
void StorageMonitorLinux::AddNewMount(const base::FilePath& mount_device, void StorageMonitorLinux::AddNewMount(const base::FilePath& mount_device,
scoped_ptr<StorageInfo> storage_info) { scoped_ptr<StorageInfo> storage_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!storage_info) if (!storage_info)
return; return;
......
...@@ -351,7 +351,7 @@ base::FilePath VolumeMountWatcherWin::DriveNumberToFilePath(int drive_number) { ...@@ -351,7 +351,7 @@ base::FilePath VolumeMountWatcherWin::DriveNumberToFilePath(int drive_number) {
// c) Retrieve metadata on the volumes and then // c) Retrieve metadata on the volumes and then
// d) Notify that metadata to listeners. // d) Notify that metadata to listeners.
void VolumeMountWatcherWin::Init() { void VolumeMountWatcherWin::Init() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
// When VolumeMountWatcherWin is created, the message pumps are not running // When VolumeMountWatcherWin is created, the message pumps are not running
// so a posted task from the constructor would never run. Therefore, do all // so a posted task from the constructor would never run. Therefore, do all
...@@ -364,7 +364,7 @@ void VolumeMountWatcherWin::Init() { ...@@ -364,7 +364,7 @@ void VolumeMountWatcherWin::Init() {
void VolumeMountWatcherWin::AddDevicesOnUIThread( void VolumeMountWatcherWin::AddDevicesOnUIThread(
std::vector<base::FilePath> removable_devices) { std::vector<base::FilePath> removable_devices) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
for (size_t i = 0; i < removable_devices.size(); i++) { for (size_t i = 0; i < removable_devices.size(); i++) {
if (ContainsKey(pending_device_checks_, removable_devices[i])) if (ContainsKey(pending_device_checks_, removable_devices[i]))
...@@ -400,7 +400,7 @@ void VolumeMountWatcherWin::RetrieveInfoForDeviceAndAdd( ...@@ -400,7 +400,7 @@ void VolumeMountWatcherWin::RetrieveInfoForDeviceAndAdd(
void VolumeMountWatcherWin::DeviceCheckComplete( void VolumeMountWatcherWin::DeviceCheckComplete(
const base::FilePath& device_path) { const base::FilePath& device_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
pending_device_checks_.erase(device_path); pending_device_checks_.erase(device_path);
if (pending_device_checks_.size() == 0) { if (pending_device_checks_.size() == 0) {
...@@ -421,7 +421,7 @@ VolumeMountWatcherWin::GetDeviceDetailsCallbackType ...@@ -421,7 +421,7 @@ VolumeMountWatcherWin::GetDeviceDetailsCallbackType
bool VolumeMountWatcherWin::GetDeviceInfo(const base::FilePath& device_path, bool VolumeMountWatcherWin::GetDeviceInfo(const base::FilePath& device_path,
StorageInfo* info) const { StorageInfo* info) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(info); DCHECK(info);
base::FilePath path(device_path); base::FilePath path(device_path);
MountPointDeviceMetadataMap::const_iterator iter = MountPointDeviceMetadataMap::const_iterator iter =
...@@ -439,7 +439,7 @@ bool VolumeMountWatcherWin::GetDeviceInfo(const base::FilePath& device_path, ...@@ -439,7 +439,7 @@ bool VolumeMountWatcherWin::GetDeviceInfo(const base::FilePath& device_path,
} }
void VolumeMountWatcherWin::OnWindowMessage(UINT event_type, LPARAM data) { void VolumeMountWatcherWin::OnWindowMessage(UINT event_type, LPARAM data) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
switch (event_type) { switch (event_type) {
case DBT_DEVICEARRIVAL: { case DBT_DEVICEARRIVAL: {
if (IsLogicalVolumeStructure(data)) { if (IsLogicalVolumeStructure(data)) {
...@@ -504,7 +504,7 @@ VolumeMountWatcherWin::~VolumeMountWatcherWin() { ...@@ -504,7 +504,7 @@ VolumeMountWatcherWin::~VolumeMountWatcherWin() {
void VolumeMountWatcherWin::HandleDeviceAttachEventOnUIThread( void VolumeMountWatcherWin::HandleDeviceAttachEventOnUIThread(
const base::FilePath& device_path, const base::FilePath& device_path,
const StorageInfo& info) { const StorageInfo& info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
device_metadata_[device_path] = info; device_metadata_[device_path] = info;
...@@ -516,7 +516,7 @@ void VolumeMountWatcherWin::HandleDeviceAttachEventOnUIThread( ...@@ -516,7 +516,7 @@ void VolumeMountWatcherWin::HandleDeviceAttachEventOnUIThread(
void VolumeMountWatcherWin::HandleDeviceDetachEventOnUIThread( void VolumeMountWatcherWin::HandleDeviceDetachEventOnUIThread(
const base::string16& device_location) { const base::string16& device_location) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
MountPointDeviceMetadataMap::const_iterator device_info = MountPointDeviceMetadataMap::const_iterator device_info =
device_metadata_.find(base::FilePath(device_location)); device_metadata_.find(base::FilePath(device_location));
...@@ -532,7 +532,7 @@ void VolumeMountWatcherWin::HandleDeviceDetachEventOnUIThread( ...@@ -532,7 +532,7 @@ void VolumeMountWatcherWin::HandleDeviceDetachEventOnUIThread(
void VolumeMountWatcherWin::EjectDevice( void VolumeMountWatcherWin::EjectDevice(
const std::string& device_id, const std::string& device_id,
base::Callback<void(StorageMonitor::EjectStatus)> callback) { base::Callback<void(StorageMonitor::EjectStatus)> callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::FilePath device = MediaStorageUtil::FindDevicePathById(device_id); base::FilePath device = MediaStorageUtil::FindDevicePathById(device_id);
if (device.empty()) { if (device.empty()) {
callback.Run(StorageMonitor::EJECT_FAILURE); callback.Run(StorageMonitor::EJECT_FAILURE);
......
...@@ -344,7 +344,7 @@ void WallpaperManagerBase::ClearDisposableWallpaperCache() { ...@@ -344,7 +344,7 @@ void WallpaperManagerBase::ClearDisposableWallpaperCache() {
} }
bool WallpaperManagerBase::GetLoggedInUserWallpaperInfo(WallpaperInfo* info) { bool WallpaperManagerBase::GetLoggedInUserWallpaperInfo(WallpaperInfo* info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (user_manager::UserManager::Get()->IsLoggedInAsStub()) { if (user_manager::UserManager::Get()->IsLoggedInAsStub()) {
info->location = current_user_wallpaper_info_.location = ""; info->location = current_user_wallpaper_info_.location = "";
...@@ -683,7 +683,7 @@ void WallpaperManagerBase::NotifyAnimationFinished() { ...@@ -683,7 +683,7 @@ void WallpaperManagerBase::NotifyAnimationFinished() {
bool WallpaperManagerBase::GetWallpaperFromCache(const std::string& user_id, bool WallpaperManagerBase::GetWallpaperFromCache(const std::string& user_id,
gfx::ImageSkia* image) { gfx::ImageSkia* image) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
CustomWallpaperMap::const_iterator it = wallpaper_cache_.find(user_id); CustomWallpaperMap::const_iterator it = wallpaper_cache_.find(user_id);
if (it != wallpaper_cache_.end() && !(*it).second.second.isNull()) { if (it != wallpaper_cache_.end() && !(*it).second.second.isNull()) {
*image = (*it).second.second; *image = (*it).second.second;
...@@ -694,7 +694,7 @@ bool WallpaperManagerBase::GetWallpaperFromCache(const std::string& user_id, ...@@ -694,7 +694,7 @@ bool WallpaperManagerBase::GetWallpaperFromCache(const std::string& user_id,
bool WallpaperManagerBase::GetPathFromCache(const std::string& user_id, bool WallpaperManagerBase::GetPathFromCache(const std::string& user_id,
base::FilePath* path) { base::FilePath* path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
CustomWallpaperMap::const_iterator it = wallpaper_cache_.find(user_id); CustomWallpaperMap::const_iterator it = wallpaper_cache_.find(user_id);
if (it != wallpaper_cache_.end()) { if (it != wallpaper_cache_.end()) {
*path = (*it).second.first; *path = (*it).second.first;
...@@ -709,7 +709,7 @@ int WallpaperManagerBase::loaded_wallpapers_for_test() const { ...@@ -709,7 +709,7 @@ int WallpaperManagerBase::loaded_wallpapers_for_test() const {
void WallpaperManagerBase::CacheUsersWallpapers() { void WallpaperManagerBase::CacheUsersWallpapers() {
// TODO(dpolukhin): crbug.com/408734. // TODO(dpolukhin): crbug.com/408734.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
user_manager::UserList users = user_manager::UserManager::Get()->GetUsers(); user_manager::UserList users = user_manager::UserManager::Get()->GetUsers();
if (!users.empty()) { if (!users.empty()) {
...@@ -943,7 +943,7 @@ void WallpaperManagerBase::OnCustomizedDefaultWallpaperDecoded( ...@@ -943,7 +943,7 @@ void WallpaperManagerBase::OnCustomizedDefaultWallpaperDecoded(
const GURL& wallpaper_url, const GURL& wallpaper_url,
scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files, scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files,
const user_manager::UserImage& wallpaper) { const user_manager::UserImage& wallpaper) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
// If decoded wallpaper is empty, we have probably failed to decode the file. // If decoded wallpaper is empty, we have probably failed to decode the file.
if (wallpaper.image().isNull()) { if (wallpaper.image().isNull()) {
......
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