diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-08 20:53:41 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-08 20:53:41 +0000 |
commit | e81ed0577b287a1346c06fc5bbd565e429f3059e (patch) | |
tree | 23fabc108bbdea823d45de860ed48f077e2a9436 /base/message_pump_win.cc | |
parent | 5849ebff0fb2bd52d9f5667fc7dd15453c11be0a (diff) | |
download | chromium_src-e81ed0577b287a1346c06fc5bbd565e429f3059e.zip chromium_src-e81ed0577b287a1346c06fc5bbd565e429f3059e.tar.gz chromium_src-e81ed0577b287a1346c06fc5bbd565e429f3059e.tar.bz2 |
Jankometer: Generalize the code more. Add better support for monitoring IO thread.
Previously, the Jankometer only monitored windows messages on the UI thread (or gtk events).
I've added observers for tasks and IO events. This lets us monitor all events on UI & IO threads (UI messages, all Tasks, and IO events).
Replaces the JankObserver with a UIJankObserver and an IOJankObserver.
Shares common code in JankObserverHelper. The JankObserverHelper and JankWatchdog are generic enough that they can probably move out to chrome/common and be reused by the renderer.
Review URL: http://codereview.chromium.org/2098020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49188 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_win.cc')
-rw-r--r-- | base/message_pump_win.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/base/message_pump_win.cc b/base/message_pump_win.cc index 1bb6cfa..6fa3e7d 100644 --- a/base/message_pump_win.cc +++ b/base/message_pump_win.cc @@ -497,9 +497,11 @@ bool MessagePumpForIO::WaitForIOCompletion(DWORD timeout, IOHandler* filter) { // Save this item for later completed_io_.push_back(item); } else { - DCHECK(item.context->handler == item.handler); + DCHECK_EQ(item.context->handler, item.handler); + WillProcessIOEvent(); item.handler->OnIOCompleted(item.context, item.bytes_transfered, item.error); + DidProcessIOEvent(); } } else { // The handler must be gone by now, just cleanup the mess. @@ -551,4 +553,20 @@ bool MessagePumpForIO::MatchCompletedIOItem(IOHandler* filter, IOItem* item) { return false; } +void MessagePumpForIO::AddIOObserver(IOObserver *obs) { + io_observers_.AddObserver(obs); +} + +void MessagePumpForIO::RemoveIOObserver(IOObserver *obs) { + io_observers_.RemoveObserver(obs); +} + +void MessagePumpForIO::WillProcessIOEvent() { + FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); +} + +void MessagePumpForIO::DidProcessIOEvent() { + FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); +} + } // namespace base |