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

Side by Side Diff: components/scheduler/child/task_queue_manager_perftest.cc

Issue 1238483003: Revert of Redirect the MessageLoop's task runner to the renderer scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/scheduler/child/task_queue_manager.h" 5 #include "components/scheduler/child/task_queue_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "components/scheduler/child/scheduler_task_runner_delegate_impl.h" 9 #include "components/scheduler/child/scheduler_message_loop_delegate.h"
10 #include "components/scheduler/child/task_queue_selector.h" 10 #include "components/scheduler/child/task_queue_selector.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "testing/perf/perf_test.h" 12 #include "testing/perf/perf_test.h"
13 13
14 namespace scheduler { 14 namespace scheduler {
15 15
16 namespace { 16 namespace {
17 17
18 class SelectorForTest : public TaskQueueSelector { 18 class SelectorForTest : public TaskQueueSelector {
19 public: 19 public:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 max_tasks_in_flight_(0), 61 max_tasks_in_flight_(0),
62 num_tasks_in_flight_(0), 62 num_tasks_in_flight_(0),
63 num_tasks_to_post_(0), 63 num_tasks_to_post_(0),
64 num_tasks_to_run_(0) {} 64 num_tasks_to_run_(0) {}
65 65
66 void Initialize(size_t num_queues) { 66 void Initialize(size_t num_queues) {
67 num_queues_ = num_queues; 67 num_queues_ = num_queues;
68 message_loop_.reset(new base::MessageLoop()); 68 message_loop_.reset(new base::MessageLoop());
69 selector_ = make_scoped_ptr(new SelectorForTest); 69 selector_ = make_scoped_ptr(new SelectorForTest);
70 manager_ = make_scoped_ptr(new TaskQueueManager( 70 manager_ = make_scoped_ptr(new TaskQueueManager(
71 num_queues, 71 num_queues, SchedulerMessageLoopDelegate::Create(message_loop_.get()),
72 SchedulerTaskRunnerDelegateImpl::Create(message_loop_.get()),
73 selector_.get(), "fake.category", "fake.category.debug")); 72 selector_.get(), "fake.category", "fake.category.debug"));
74 } 73 }
75 74
76 void TestDelayedTask() { 75 void TestDelayedTask() {
77 if (--num_tasks_to_run_ == 0) { 76 if (--num_tasks_to_run_ == 0) {
78 message_loop_->Quit(); 77 message_loop_->Quit();
79 } 78 }
80 79
81 num_tasks_in_flight_--; 80 num_tasks_in_flight_--;
82 // NOTE there are only up to max_tasks_in_flight_ pending delayed tasks at 81 // NOTE there are only up to max_tasks_in_flight_ pending delayed tasks at
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 max_tasks_in_flight_ = 200; 166 max_tasks_in_flight_ = 200;
168 Benchmark("run 10000 delayed tasks with eight queues", 167 Benchmark("run 10000 delayed tasks with eight queues",
169 base::Bind(&TaskQueueManagerPerfTest::ResetAndCallTestDelayedTask, 168 base::Bind(&TaskQueueManagerPerfTest::ResetAndCallTestDelayedTask,
170 base::Unretained(this), 10000)); 169 base::Unretained(this), 10000));
171 } 170 }
172 171
173 // TODO(alexclarke): Add additional tests with different mixes of non-delayed vs 172 // TODO(alexclarke): Add additional tests with different mixes of non-delayed vs
174 // delayed tasks. 173 // delayed tasks.
175 174
176 } // namespace scheduler 175 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698