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

Unified Diff: chrome/browser/sync/notifier/chrome_system_resources.cc

Issue 5517004: sync: more debugging for crash in ChromeSystemResources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/debug
Patch Set: Created 10 years 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
« no previous file with comments | « chrome/browser/sync/notifier/chrome_system_resources.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/notifier/chrome_system_resources.cc
diff --git a/chrome/browser/sync/notifier/chrome_system_resources.cc b/chrome/browser/sync/notifier/chrome_system_resources.cc
index 46090e1e7288a58e6130f1de94ad2d0dda37597d..c7173ecd89663c75b77cef4600f5649a1d015c8c 100644
--- a/chrome/browser/sync/notifier/chrome_system_resources.cc
+++ b/chrome/browser/sync/notifier/chrome_system_resources.cc
@@ -17,29 +17,35 @@
namespace sync_notifier {
ChromeSystemResources::ChromeSystemResources(StateWriter* state_writer)
- : state_writer_(state_writer) {
- CHECK(non_thread_safe_.CalledOnValidThread());
+ : state_writer_(state_writer),
+ created_on_loop_(MessageLoop::current()) {
+ DCHECK(non_thread_safe_.CalledOnValidThread());
+ CHECK(created_on_loop_);
DCHECK(state_writer_);
}
ChromeSystemResources::~ChromeSystemResources() {
- CHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(non_thread_safe_.CalledOnValidThread());
+ CHECK_EQ(created_on_loop_, MessageLoop::current());
StopScheduler();
}
invalidation::Time ChromeSystemResources::current_time() {
- CHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(non_thread_safe_.CalledOnValidThread());
+ CHECK_EQ(created_on_loop_, MessageLoop::current());
return base::Time::Now();
}
void ChromeSystemResources::StartScheduler() {
- CHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(non_thread_safe_.CalledOnValidThread());
+ CHECK_EQ(created_on_loop_, MessageLoop::current());
scoped_runnable_method_factory_.reset(
new ScopedRunnableMethodFactory<ChromeSystemResources>(this));
}
void ChromeSystemResources::StopScheduler() {
- CHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(non_thread_safe_.CalledOnValidThread());
+ CHECK_EQ(created_on_loop_, MessageLoop::current());
scoped_runnable_method_factory_.reset();
STLDeleteElements(&posted_tasks_);
}
@@ -47,7 +53,8 @@ void ChromeSystemResources::StopScheduler() {
void ChromeSystemResources::ScheduleWithDelay(
invalidation::TimeDelta delay,
invalidation::Closure* task) {
- CHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(non_thread_safe_.CalledOnValidThread());
+ CHECK_EQ(created_on_loop_, MessageLoop::current());
Task* task_to_post = MakeTaskToPost(task);
if (!task_to_post) {
return;
@@ -58,7 +65,8 @@ void ChromeSystemResources::ScheduleWithDelay(
void ChromeSystemResources::ScheduleImmediately(
invalidation::Closure* task) {
- CHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(non_thread_safe_.CalledOnValidThread());
+ CHECK_EQ(created_on_loop_, MessageLoop::current());
Task* task_to_post = MakeTaskToPost(task);
if (!task_to_post) {
return;
@@ -70,14 +78,16 @@ void ChromeSystemResources::ScheduleImmediately(
// notifications thread).
void ChromeSystemResources::ScheduleOnListenerThread(
invalidation::Closure* task) {
- CHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(non_thread_safe_.CalledOnValidThread());
+ CHECK_EQ(created_on_loop_, MessageLoop::current());
ScheduleImmediately(task);
}
// 'Internal thread' means 'not the listener thread'. Since the
// listener thread is the notifications thread, always return false.
bool ChromeSystemResources::IsRunningOnInternalThread() {
- CHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(non_thread_safe_.CalledOnValidThread());
+ CHECK_EQ(created_on_loop_, MessageLoop::current());
return false;
}
@@ -134,8 +144,9 @@ void ChromeSystemResources::WriteState(
Task* ChromeSystemResources::MakeTaskToPost(
invalidation::Closure* task) {
- CHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(non_thread_safe_.CalledOnValidThread());
DCHECK(invalidation::IsCallbackRepeatable(task));
+ CHECK_EQ(created_on_loop_, MessageLoop::current());
if (!scoped_runnable_method_factory_.get()) {
delete task;
return NULL;
@@ -148,7 +159,8 @@ Task* ChromeSystemResources::MakeTaskToPost(
}
void ChromeSystemResources::RunPostedTask(invalidation::Closure* task) {
- CHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(non_thread_safe_.CalledOnValidThread());
+ CHECK_EQ(created_on_loop_, MessageLoop::current());
RunAndDeleteClosure(task);
posted_tasks_.erase(task);
}
« no previous file with comments | « chrome/browser/sync/notifier/chrome_system_resources.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698