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

Side by Side Diff: views/repeat_controller.cc

Issue 7825026: Revert "Currently, base/timer.cc calls PostTask with FROM_HERE as the Location, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/throbber.cc ('k') | views/touchui/touch_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/repeat_controller.h" 5 #include "views/repeat_controller.h"
6 6
7 using base::TimeDelta; 7 using base::TimeDelta;
8 8
9 namespace views { 9 namespace views {
10 10
11 // The delay before the first and then subsequent repeats. Values taken from 11 // The delay before the first and then subsequent repeats. Values taken from
12 // XUL code: http://mxr.mozilla.org/seamonkey/source/layout/xul/base/src/nsRepea tService.cpp#52 12 // XUL code: http://mxr.mozilla.org/seamonkey/source/layout/xul/base/src/nsRepea tService.cpp#52
13 static const int kInitialRepeatDelay = 250; 13 static const int kInitialRepeatDelay = 250;
14 static const int kRepeatDelay = 50; 14 static const int kRepeatDelay = 50;
15 15
16 /////////////////////////////////////////////////////////////////////////////// 16 ///////////////////////////////////////////////////////////////////////////////
17 // RepeatController, public: 17 // RepeatController, public:
18 18
19 RepeatController::RepeatController(RepeatCallback* callback) 19 RepeatController::RepeatController(RepeatCallback* callback)
20 : callback_(callback) { 20 : callback_(callback) {
21 } 21 }
22 22
23 RepeatController::~RepeatController() { 23 RepeatController::~RepeatController() {
24 } 24 }
25 25
26 void RepeatController::Start() { 26 void RepeatController::Start() {
27 // The first timer is slightly longer than subsequent repeats. 27 // The first timer is slightly longer than subsequent repeats.
28 timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(kInitialRepeatDelay), 28 timer_.Start(TimeDelta::FromMilliseconds(kInitialRepeatDelay), this,
29 this, &RepeatController::Run); 29 &RepeatController::Run);
30 } 30 }
31 31
32 void RepeatController::Stop() { 32 void RepeatController::Stop() {
33 timer_.Stop(); 33 timer_.Stop();
34 } 34 }
35 35
36 /////////////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////////////
37 // RepeatController, private: 37 // RepeatController, private:
38 38
39 void RepeatController::Run() { 39 void RepeatController::Run() {
40 timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(kRepeatDelay), this, 40 timer_.Start(TimeDelta::FromMilliseconds(kRepeatDelay), this,
41 &RepeatController::Run); 41 &RepeatController::Run);
42 callback_->Run(); 42 callback_->Run();
43 } 43 }
44 44
45 } // namespace views 45 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/throbber.cc ('k') | views/touchui/touch_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698