summaryrefslogtreecommitdiffstats
path: root/base/message_pump_win.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-08 20:53:41 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-08 20:53:41 +0000
commite81ed0577b287a1346c06fc5bbd565e429f3059e (patch)
tree23fabc108bbdea823d45de860ed48f077e2a9436 /base/message_pump_win.h
parent5849ebff0fb2bd52d9f5667fc7dd15453c11be0a (diff)
downloadchromium_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.h')
-rw-r--r--base/message_pump_win.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/base/message_pump_win.h b/base/message_pump_win.h
index e6ea233..9608187 100644
--- a/base/message_pump_win.h
+++ b/base/message_pump_win.h
@@ -9,6 +9,7 @@
#include <list>
+#include "base/basictypes.h"
#include "base/lock.h"
#include "base/message_pump.h"
#include "base/observer_list.h"
@@ -23,7 +24,7 @@ namespace base {
class MessagePumpWin : public MessagePump {
public:
// An Observer is an object that receives global notifications from the
- // MessageLoop.
+ // UI MessageLoop.
//
// NOTE: An Observer implementation should be extremely fast!
//
@@ -283,6 +284,21 @@ class MessagePumpForIO : public MessagePumpWin {
DWORD error) = 0;
};
+ // An IOObserver is an object that receives IO notifications from the
+ // MessagePump.
+ //
+ // NOTE: An IOObserver implementation should be extremely fast!
+ class IOObserver {
+ public:
+ IOObserver() {}
+
+ virtual void WillProcessIOEvent() = 0;
+ virtual void DidProcessIOEvent() = 0;
+
+ protected:
+ virtual ~IOObserver() {}
+ };
+
// The extended context that should be used as the base structure on every
// overlapped IO operation. |handler| must be set to the registered IOHandler
// for the given file when the operation is started, and it can be set to NULL
@@ -320,6 +336,9 @@ class MessagePumpForIO : public MessagePumpWin {
// caller is willing to allow pausing regular task dispatching on this thread.
bool WaitForIOCompletion(DWORD timeout, IOHandler* filter);
+ void AddIOObserver(IOObserver* obs);
+ void RemoveIOObserver(IOObserver* obs);
+
private:
struct IOItem {
IOHandler* handler;
@@ -333,12 +352,16 @@ class MessagePumpForIO : public MessagePumpWin {
bool MatchCompletedIOItem(IOHandler* filter, IOItem* item);
bool GetIOItem(DWORD timeout, IOItem* item);
bool ProcessInternalIOItem(const IOItem& item);
+ void WillProcessIOEvent();
+ void DidProcessIOEvent();
// The completion port associated with this thread.
ScopedHandle port_;
// This list will be empty almost always. It stores IO completions that have
// not been delivered yet because somebody was doing cleanup.
std::list<IOItem> completed_io_;
+
+ ObserverList<IOObserver> io_observers_;
};
} // namespace base