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

Unified Diff: chrome/browser/jankometer.cc

Issue 6463013: Add support for base::Closure in the MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/base
Patch Set: rebased Created 9 years, 9 months 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
Index: chrome/browser/jankometer.cc
diff --git a/chrome/browser/jankometer.cc b/chrome/browser/jankometer.cc
index 4da57516a0731b258985c1542e6b41c0616a5b2e..6d78af7a00d016009792312fdf575862df2a8688 100644
--- a/chrome/browser/jankometer.cc
+++ b/chrome/browser/jankometer.cc
@@ -212,7 +212,7 @@ int JankObserverHelper::discard_count_ = 99; // Measure only 1 in 100.
//------------------------------------------------------------------------------
class IOJankObserver : public base::RefCountedThreadSafe<IOJankObserver>,
public MessageLoopForIO::IOObserver,
- public MessageLoop::TaskObserver {
+ public MessageLoop::ClosureObserver {
public:
IOJankObserver(const char* thread_name,
TimeDelta excessive_duration,
@@ -225,35 +225,35 @@ class IOJankObserver : public base::RefCountedThreadSafe<IOJankObserver>,
// attach to the current thread, so this function can be invoked on another
// thread to attach it.
void AttachToCurrentThread() {
- MessageLoop::current()->AddTaskObserver(this);
+ MessageLoop::current()->AddClosureObserver(this);
MessageLoopForIO::current()->AddIOObserver(this);
}
// Detaches the observer to the current thread's message loop.
void DetachFromCurrentThread() {
MessageLoopForIO::current()->RemoveIOObserver(this);
- MessageLoop::current()->RemoveTaskObserver(this);
+ MessageLoop::current()->RemoveClosureObserver(this);
}
- virtual void WillProcessIOEvent() {
+ virtual void WillProcessIOEvent() OVERRIDE {
if (!helper_.MessageWillBeMeasured())
return;
helper_.StartProcessingTimers(base::TimeDelta());
}
- virtual void DidProcessIOEvent() {
+ virtual void DidProcessIOEvent() OVERRIDE {
helper_.EndProcessingTimers();
}
- virtual void WillProcessTask(const Task* task) {
+ virtual void WillProcessClosure(base::TimeTicks time_posted) OVERRIDE {
if (!helper_.MessageWillBeMeasured())
return;
base::TimeTicks now = base::TimeTicks::Now();
- const base::TimeDelta queueing_time = now - task->tracked_birth_time();
+ const base::TimeDelta queueing_time = now - time_posted;
helper_.StartProcessingTimers(queueing_time);
}
- virtual void DidProcessTask(const Task* task) {
+ virtual void DidProcessClosure(base::TimeTicks time_posted) OVERRIDE {
helper_.EndProcessingTimers();
}
@@ -267,7 +267,7 @@ class IOJankObserver : public base::RefCountedThreadSafe<IOJankObserver>,
//------------------------------------------------------------------------------
class UIJankObserver : public base::RefCountedThreadSafe<UIJankObserver>,
- public MessageLoop::TaskObserver,
+ public MessageLoop::ClosureObserver,
public MessageLoopForUI::Observer {
public:
UIJankObserver(const char* thread_name,
@@ -281,25 +281,25 @@ class UIJankObserver : public base::RefCountedThreadSafe<UIJankObserver>,
void AttachToCurrentThread() {
DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI);
MessageLoopForUI::current()->AddObserver(this);
- MessageLoop::current()->AddTaskObserver(this);
+ MessageLoop::current()->AddClosureObserver(this);
}
// Detaches the observer to the current thread's message loop.
void DetachFromCurrentThread() {
DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI);
- MessageLoop::current()->RemoveTaskObserver(this);
+ MessageLoop::current()->RemoveClosureObserver(this);
MessageLoopForUI::current()->RemoveObserver(this);
}
- virtual void WillProcessTask(const Task* task) {
+ virtual void WillProcessClosure(base::TimeTicks time_posted) OVERRIDE {
if (!helper_.MessageWillBeMeasured())
return;
base::TimeTicks now = base::TimeTicks::Now();
- const base::TimeDelta queueing_time = now - task->tracked_birth_time();
+ const base::TimeDelta queueing_time = now - time_posted;
helper_.StartProcessingTimers(queueing_time);
}
- virtual void DidProcessTask(const Task* task) {
+ virtual void DidProcessClosure(base::TimeTicks time_posted) OVERRIDE {
helper_.EndProcessingTimers();
}

Powered by Google App Engine
This is Rietveld 408576698