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

Side by Side Diff: base/run_loop.cc

Issue 445413003: Creating a framework for suppressing pollution of the profiler data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing unit tests again. Created 6 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 | « base/profiler/tracked_time_unittest.cc ('k') | base/threading/sequenced_worker_pool.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/run_loop.h" 5 #include "base/run_loop.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/tracked_objects.h"
8 9
9 #if defined(OS_WIN) 10 #if defined(OS_WIN)
10 #include "base/message_loop/message_pump_dispatcher.h" 11 #include "base/message_loop/message_pump_dispatcher.h"
11 #endif 12 #endif
12 13
13 namespace base { 14 namespace base {
14 15
15 RunLoop::RunLoop() 16 RunLoop::RunLoop()
16 : loop_(MessageLoop::current()), 17 : loop_(MessageLoop::current()),
17 previous_run_loop_(NULL), 18 previous_run_loop_(NULL),
(...skipping 21 matching lines...) Expand all
39 weak_factory_(this) { 40 weak_factory_(this) {
40 } 41 }
41 #endif 42 #endif
42 43
43 RunLoop::~RunLoop() { 44 RunLoop::~RunLoop() {
44 } 45 }
45 46
46 void RunLoop::Run() { 47 void RunLoop::Run() {
47 if (!BeforeRun()) 48 if (!BeforeRun())
48 return; 49 return;
50
51 // Use task stopwatch to exclude the loop run time from the current task, if
52 // any.
53 tracked_objects::TaskStopwatch stopwatch;
49 loop_->RunHandler(); 54 loop_->RunHandler();
55 stopwatch.Stop();
56
50 AfterRun(); 57 AfterRun();
51 } 58 }
52 59
53 void RunLoop::RunUntilIdle() { 60 void RunLoop::RunUntilIdle() {
54 quit_when_idle_received_ = true; 61 quit_when_idle_received_ = true;
55 Run(); 62 Run();
56 } 63 }
57 64
58 void RunLoop::Quit() { 65 void RunLoop::Quit() {
59 quit_called_ = true; 66 quit_called_ = true;
(...skipping 29 matching lines...) Expand all
89 96
90 // Pop RunLoop stack: 97 // Pop RunLoop stack:
91 loop_->run_loop_ = previous_run_loop_; 98 loop_->run_loop_ = previous_run_loop_;
92 99
93 // Execute deferred QuitNow, if any: 100 // Execute deferred QuitNow, if any:
94 if (previous_run_loop_ && previous_run_loop_->quit_called_) 101 if (previous_run_loop_ && previous_run_loop_->quit_called_)
95 loop_->QuitNow(); 102 loop_->QuitNow();
96 } 103 }
97 104
98 } // namespace base 105 } // namespace base
OLDNEW
« no previous file with comments | « base/profiler/tracked_time_unittest.cc ('k') | base/threading/sequenced_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698