Commit 8380ebee authored by dcheng@chromium.org's avatar dcheng@chromium.org

Remove Task inheritance from base::Timer.

BUG=none
TEST=trybots
TBR=brettw

Review URL: http://codereview.chromium.org/8898019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114679 0039d316-1c4b-4281-b951-d872f2087c98
parent 99d3f1cc
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/timer.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/message_loop.h"
namespace base {
......@@ -21,7 +23,8 @@ void BaseTimer_Helper::InitiateDelayedTask(TimerTask* timer_task) {
delayed_task_ = timer_task;
delayed_task_->timer_ = this;
MessageLoop::current()->PostDelayedTask(
timer_task->posted_from_, timer_task,
timer_task->posted_from_,
base::Bind(&TimerTask::Run, base::Owned(timer_task)),
static_cast<int>(timer_task->delay_.InMillisecondsRoundedUp()));
}
......
......@@ -50,7 +50,6 @@
#include "base/base_export.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/task.h"
#include "base/time.h"
class MessageLoop;
......@@ -86,7 +85,7 @@ class BASE_EXPORT BaseTimer_Helper {
BaseTimer_Helper() : delayed_task_(NULL) {}
// We have access to the timer_ member so we can orphan this task.
class TimerTask : public Task {
class TimerTask {
public:
TimerTask(const tracked_objects::Location& posted_from,
TimeDelta delay)
......@@ -95,6 +94,7 @@ class BASE_EXPORT BaseTimer_Helper {
delay_(delay) {
}
virtual ~TimerTask() {}
virtual void Run() = 0;
tracked_objects::Location posted_from_;
BaseTimer_Helper* timer_;
TimeDelta delay_;
......@@ -170,7 +170,7 @@ class BaseTimer : public BaseTimer_Helper {
ResetBaseTimer();
else
ClearBaseTimer();
DispatchToMethod(receiver_, method_, Tuple0());
(receiver_->*method_)();
}
TimerTask* Clone() const {
......
......@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
#pragma once
#include "base/memory/weak_ptr.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
#include "chrome/browser/autocomplete/autocomplete_popup_view.h"
......
......@@ -13,6 +13,7 @@
#include "base/callback.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/process_util.h"
#include "base/property_bag.h"
#include "base/string16.h"
......
......@@ -15,6 +15,7 @@
#endif
#include "base/memory/scoped_handle.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/shared_memory.h"
#include "base/timer.h"
#include "googleurl/src/gurl.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment