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

Unified Diff: components/nacl/browser/nacl_browser.cc

Issue 1043013002: favor DCHECK_CURRENTLY_ON for better logs in components/ (part 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: content namespace needed after all Created 5 years, 8 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: components/nacl/browser/nacl_browser.cc
diff --git a/components/nacl/browser/nacl_browser.cc b/components/nacl/browser/nacl_browser.cc
index f53b3e0d2366bd59e0a19f6be4e2b950ad1e3242..733e9d96652b40982cdb4a9f3aa25966380b2de6 100644
--- a/components/nacl/browser/nacl_browser.cc
+++ b/components/nacl/browser/nacl_browser.cc
@@ -168,7 +168,7 @@ NaClBrowserDelegate* NaClBrowser::GetDelegate() {
}
void NaClBrowser::EarlyStartup() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
InitIrtFilePath();
InitValidationCacheFilePath();
}
@@ -225,21 +225,21 @@ bool NaClBrowser::IsOk() const {
}
const base::File& NaClBrowser::IrtFile() const {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
CHECK_EQ(irt_state_, NaClResourceReady);
CHECK(irt_file_.IsValid());
return irt_file_;
}
void NaClBrowser::EnsureAllResourcesAvailable() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
EnsureIrtAvailable();
EnsureValidationCacheAvailable();
}
// Load the IRT async.
void NaClBrowser::EnsureIrtAvailable() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (IsOk() && irt_state_ == NaClResourceUninitialized) {
irt_state_ = NaClResourceRequested;
// TODO(ncbray) use blocking pool.
@@ -260,7 +260,7 @@ void NaClBrowser::EnsureIrtAvailable() {
void NaClBrowser::OnIrtOpened(scoped_ptr<base::FileProxy> file_proxy,
base::File::Error error_code) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK_EQ(irt_state_, NaClResourceRequested);
if (file_proxy->IsValid()) {
irt_file_ = file_proxy->TakeFile();
@@ -322,7 +322,7 @@ void NaClBrowser::InitValidationCacheFilePath() {
}
void NaClBrowser::EnsureValidationCacheAvailable() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (IsOk() && validation_cache_state_ == NaClResourceUninitialized) {
if (ValidationCacheIsEnabled()) {
validation_cache_state_ = NaClResourceRequested;
@@ -347,7 +347,7 @@ void NaClBrowser::EnsureValidationCacheAvailable() {
}
void NaClBrowser::OnValidationCacheLoaded(const std::string *data) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
// Did the cache get cleared before the load completed? If so, ignore the
// incoming data.
if (validation_cache_state_ == NaClResourceReady)
@@ -373,7 +373,7 @@ void NaClBrowser::RunWithoutValidationCache() {
}
void NaClBrowser::CheckWaiting() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (!IsOk() || IsReady()) {
// Queue the waiting tasks into the message loop. This helps avoid
// re-entrancy problems that could occur if the closure was invoked
@@ -404,7 +404,7 @@ const base::FilePath& NaClBrowser::GetIrtFilePath() {
void NaClBrowser::PutFilePath(const base::FilePath& path, uint64* file_token_lo,
uint64* file_token_hi) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
while (true) {
uint64 file_token[2] = {base::RandUint64(), base::RandUint64()};
// A zero file_token indicates there is no file_token, if we get zero, ask
@@ -425,7 +425,7 @@ void NaClBrowser::PutFilePath(const base::FilePath& path, uint64* file_token_lo,
bool NaClBrowser::GetFilePath(uint64 file_token_lo, uint64 file_token_hi,
base::FilePath* path) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
uint64 file_token[2] = {file_token_lo, file_token_hi};
std::string key(reinterpret_cast<char*>(file_token), sizeof(file_token));
PathCacheType::iterator iter = path_cache_.Peek(key);
@@ -441,7 +441,7 @@ bool NaClBrowser::GetFilePath(uint64 file_token_lo, uint64 file_token_hi,
bool NaClBrowser::QueryKnownToValidate(const std::string& signature,
bool off_the_record) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (off_the_record) {
// If we're off the record, don't reorder the main cache.
return validation_cache_.QueryKnownToValidate(signature, false) ||
@@ -457,7 +457,7 @@ bool NaClBrowser::QueryKnownToValidate(const std::string& signature,
void NaClBrowser::SetKnownToValidate(const std::string& signature,
bool off_the_record) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (off_the_record) {
off_the_record_validation_cache_.SetKnownToValidate(signature);
} else {
@@ -470,7 +470,7 @@ void NaClBrowser::SetKnownToValidate(const std::string& signature,
}
void NaClBrowser::ClearValidationCache(const base::Closure& callback) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
// Note: this method may be called before EnsureValidationCacheAvailable has
// been invoked. In other words, this method may be called before any NaCl
// processes have been created. This method must succeed and invoke the
@@ -522,7 +522,7 @@ void NaClBrowser::MarkValidationCacheAsModified() {
}
void NaClBrowser::PersistValidationCache() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
// validation_cache_is_modified_ may be false if the cache was cleared while
// this delayed task was pending.
// validation_cache_file_path_ may be empty if something went wrong during
@@ -549,7 +549,7 @@ void NaClBrowser::OnProcessEnd(int process_id) {
}
void NaClBrowser::OnProcessCrashed() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (crash_times_.size() == kMaxCrashesPerInterval) {
crash_times_.pop_front();
}
@@ -558,7 +558,7 @@ void NaClBrowser::OnProcessCrashed() {
}
bool NaClBrowser::IsThrottled() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (crash_times_.size() != kMaxCrashesPerInterval) {
return false;
}

Powered by Google App Engine
This is Rietveld 408576698