| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/performance_monitor/performance_monitor.h" | 5 #include "chrome/browser/performance_monitor/performance_monitor.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/threading/worker_pool.h" | 9 #include "base/threading/worker_pool.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 base::Bind(&PerformanceMonitor::CheckForVersionUpdateOnBackgroundThread, | 69 base::Bind(&PerformanceMonitor::CheckForVersionUpdateOnBackgroundThread, |
| 70 base::Unretained(this))); | 70 base::Unretained(this))); |
| 71 | 71 |
| 72 // Post a task to the background thread to a function which does nothing. | 72 // Post a task to the background thread to a function which does nothing. |
| 73 // This will force any tasks the database is performing to finish prior to | 73 // This will force any tasks the database is performing to finish prior to |
| 74 // the reply being sent, since they use the same thread. | 74 // the reply being sent, since they use the same thread. |
| 75 // | 75 // |
| 76 // Important! Make sure that methods in FinishInit() only rely on posting | 76 // Important! Make sure that methods in FinishInit() only rely on posting |
| 77 // to the background thread, and do not rely upon a reply from the background | 77 // to the background thread, and do not rely upon a reply from the background |
| 78 // thread; this is necessary for this notification to be valid. | 78 // thread; this is necessary for this notification to be valid. |
| 79 util::PostTaskToDatabaseAndReply( | 79 util::PostTaskToDatabaseThreadAndReply( |
| 80 base::Bind(&base::DoNothing), | 80 base::Bind(&base::DoNothing), |
| 81 base::Bind(&PerformanceMonitor::NotifyInitialized, | 81 base::Bind(&PerformanceMonitor::NotifyInitialized, |
| 82 base::Unretained(this))); | 82 base::Unretained(this))); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void PerformanceMonitor::RegisterForNotifications() { | 85 void PerformanceMonitor::RegisterForNotifications() { |
| 86 // Extensions | 86 // Extensions |
| 87 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 87 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 88 content::NotificationService::AllSources()); | 88 content::NotificationService::AllSources()); |
| 89 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_ENABLED, | 89 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_ENABLED, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 extension->description())); | 210 extension->description())); |
| 211 break; | 211 break; |
| 212 } | 212 } |
| 213 default: { | 213 default: { |
| 214 NOTREACHED(); | 214 NOTREACHED(); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace performance_monitor | 219 } // namespace performance_monitor |
| OLD | NEW |