summaryrefslogtreecommitdiffstats
path: root/chrome/browser/jankometer.cc
diff options
context:
space:
mode:
authordarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-26 05:55:10 +0000
committerdarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-26 05:55:10 +0000
commitab820df141e6ab45fd8a095d2f57f91df44e6c9c (patch)
tree20ae83601c4a484cd74c908b62bc9d702ef27996 /chrome/browser/jankometer.cc
parent4d9bdfafcd1393385860bc9fe947e0c07719c0f4 (diff)
downloadchromium_src-ab820df141e6ab45fd8a095d2f57f91df44e6c9c.zip
chromium_src-ab820df141e6ab45fd8a095d2f57f91df44e6c9c.tar.gz
chromium_src-ab820df141e6ab45fd8a095d2f57f91df44e6c9c.tar.bz2
Chrome changes corresponding to my message_loop_type CL.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1363 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/jankometer.cc')
-rw-r--r--chrome/browser/jankometer.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/chrome/browser/jankometer.cc b/chrome/browser/jankometer.cc
index 8ee411e..495b849 100644
--- a/chrome/browser/jankometer.cc
+++ b/chrome/browser/jankometer.cc
@@ -73,7 +73,7 @@ class JankWatchdog : public Watchdog {
//------------------------------------------------------------------------------
class JankObserver : public base::RefCountedThreadSafe<JankObserver>,
- public MessageLoop::Observer {
+ public MessageLoopForUI::Observer {
public:
JankObserver(const wchar_t* thread_name,
const TimeDelta& excessive_duration,
@@ -95,12 +95,15 @@ class JankObserver : public base::RefCountedThreadSafe<JankObserver>,
// attach to the current thread, so this function can be invoked on another
// thread to attach it.
void AttachToCurrentThread() {
- MessageLoop::current()->AddObserver(this);
+ // TODO(darin): support monitoring jankiness on non-UI threads!
+ if (MessageLoop::current()->type() == MessageLoop::TYPE_UI)
+ MessageLoopForUI::current()->AddObserver(this);
}
// Detaches the observer to the current thread's message loop.
void DetachFromCurrentThread() {
- MessageLoop::current()->RemoveObserver(this);
+ if (MessageLoop::current()->type() == MessageLoop::TYPE_UI)
+ MessageLoopForUI::current()->RemoveObserver(this);
}
void WillProcessMessage(const MSG& msg) {
@@ -200,7 +203,7 @@ void InstallJankometer(const CommandLine &parsed_command_line) {
TimeDelta::FromMilliseconds(kMaxIOMessageDelayMs),
io_watchdog_enabled);
io_observer->AddRef();
- Thread* io_thread = g_browser_process->io_thread();
+ base::Thread* io_thread = g_browser_process->io_thread();
if (io_thread) {
io_thread->message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(io_observer,